EMAN2
Functions
emdata_metadata.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

EMData * get_fft_amplitude ()
 $Id$
EMData * get_fft_amplitude2D ()
 return the amplitudes of the 2D FFT including the left half PRB

Exceptions:
ImageFormatExceptionIf the image is not a complex image.

EMData * get_fft_phase ()
 return the phases of the FFT including the left half
float * get_data () const
 Get the image pixel density data in a 1D float array.
const float * get_const_data () const
 Get the image pixel density data in a 1D float array - const version of get_data.
void set_data (float *data, const int x, const int y, const int z)
 Set the data explicitly data pointer must be allocated using malloc!
void set_data (float *data)
void write_data (string fsp, size_t loc, const Region *const area=0, const int file_nx=0, const int file_ny=0, const int file_nz=0)
 Dump the image pixel data in native byte order to a disk file.
void read_data (string fsp, size_t loc, const Region *area=0, const int file_nx=0, const int file_ny=0, const int file_nz=0)
 Read the image pixel data in native byte order from a disk file.
void update ()
 Mark EMData as changed, statistics, etc will be updated at need.
void clearupdate ()
 turn off updates.
bool has_ctff () const
 check whether the image physical file has the CTF info or not.
float calc_center_density ()
 Calculates the density value at the peak of the image histogram, sort of like the mode of the density.
float calc_sigma_diff ()
 Calculates sigma above and below the mean and returns the difference between them.
IntPoint calc_min_location () const
 Calculates the coordinates of the minimum-value pixel.
IntPoint calc_max_location () const
 Calculates the coordinates of the maximum-value pixel.
IntPoint calc_max_location_wrap (const int maxshiftx=-1, const int maxshifty=-1, const int maxshiftz=-1)
 Calculates the wrapped coordinates of the maximum value This function is useful in the context of Fourier correlation you can call this function to find the correct translational shift when using calc_ccf etc.
vector< float > calc_max_location_wrap_intp (const int maxshiftx=-1, const int maxshifty=-1, const int maxshiftz=-1)
 Calculates the wrapped coordinates of the maximum value, and uses quadration intp to subpixel prec This function is useful in the context of Fourier correlation you can call this function to find the correct translational shift when using calc_ccf etc.
FloatPoint calc_center_of_mass (const float threshold=0)
 Calculate the center of mass with a threshold (Default 0, so only positive values are considered)
size_t calc_min_index () const
 Calculates the index of minimum-value pixel when assuming all pixels are in a 1D array.
size_t calc_max_index () const
 Calculates the index of maximum-value pixel when assuming all pixels are in a 1D array.
vector< Pixel > calc_highest_locations (float threshold) const
 Calculate and return a sorted list of pixels whose values are above a specified threshold.
vector< Pixel > calc_n_highest_locations (int n)
 Calculate and return a sorted list of N highest pixels in the map.
vector< Pixel > find_pixels_with_value (float val)
 Find pixels in the image with exactly the specified values.
float get_edge_mean () const
 Calculates the mean pixel values around the (1 pixel) edge of the image.
float get_circle_mean ()
 Calculates the circular edge mean by applying a circular mask on 'this' image.
Ctf * get_ctf () const
 Get ctf parameter of this image.
void set_ctf (Ctf *ctf)
 Set the CTF parameter of this image.
Vec3f get_translation () const
 Get 'this' image's translation vector from the original location.
void set_translation (const Vec3f &t)
 Set 'this' images' translation vector from the original location.
void set_translation (float dx, float dy, float dz)
 Set 'this' images' translation vector from the original location.
Transform get_transform () const
 Get the 3D orientation of 'this' image.
void set_rotation (float az, float alt, float phi)
 Define the 3D orientation of this particle, also used to indicate relative rotations for reconstructions.
void set_rotation (const Transform &t3d)
 Define the 3D orientation of this particle Orientation information is extracted from a Transform object and stored internally in EMAN (az,alt,phi) format.
void set_size (int nx, int ny=1, int nz=1, bool noalloc=false)
 Resize this EMData's main board memory pointer.
void set_complex_size (int nx, int ny=1, int nz=1)
 Resize 'this' complex image.
void set_path (const string &new_path)
 Set the path.
void set_pathnum (int n)
 Set the number of paths.
MArray2D get_2dview () const
 Get image raw pixel data in a 2D multi-array format.
MArray3D get_3dview () const
 Get image raw pixel data in a 3D multi-array format.
MCArray2D get_2dcview () const
 Get complex image raw pixel data in a 2D multi-array format.
MCArray3D get_3dcview () const
 Get complex image raw pixel data in a 3D multi-array format.
MCArray3D * get_3dcviewptr () const
 Get pointer to a complex image raw pixel data in a 3D multi-array format.
MArray2D get_2dview (int x0, int y0) const
 Get image raw pixel data in a 2D multi-array format.
MArray3D get_3dview (int x0, int y0, int z0) const
 Get image raw pixel data in a 3D multi-array format.
MCArray2D get_2dcview (int x0, int y0) const
 Get complex image raw pixel data in a 2D multi-array format.
MCArray3D get_3dcview (int x0, int y0, int z0) const
 Get complex image raw pixel data in a 3D multi-array format.
EMObject get_attr (const string &attr_name) const
 The generic way to get any image header information given a header attribute name.
EMObject get_attr_default (const string &attr_name, const EMObject &em_obj=EMObject()) const
 The generic way to get any image header information given a header attribute name.
void set_attr (const string &key, EMObject val)
 Set a header attribute's value.
void set_attr_python (const string &key, EMObject val)
 Set a header attribute's value from Python.
bool has_attr (const string &key) const
 Ask if the header has a particular attribute.
Dict get_attr_dict () const
 Get the image attribute dictionary containing all the image attribute names and attribute values.
void set_attr_dict (const Dict &new_dict)
 Merge the new values with the existing dictionary.
void del_attr (const string &attr_name)
 Delete the attribute from dictionary.
void del_attr_dict (const vector< string > &del_keys)
 Delete the attributes from the dictionary.
int get_xsize () const
 Get the image x-dimensional size.
int get_ysize () const
 Get the image y-dimensional size.
int get_zsize () const
 Get the image z-dimensional size.
size_t get_size () const
 Get the number of allocated floats in the image (nx*ny*nz)
vector< float > get_data_as_vector () const
 Get the pixel data as a vector.
int get_ndim () const
 Get image dimension.
bool is_shuffled () const
 Has this image been shuffled?
bool is_FH () const
 Is this a FH image?
bool is_complex () const
 Is this a complex image?
bool is_real () const
 Is this a real image?
void set_shuffled (bool is_shuffled)
 Mark this image as a shuffled image.
void set_FH (bool is_FH)
 Mark this complex image as a FH image.
void set_complex (bool is_complex)
 Mark this image as a complex image.
bool is_complex_x () const
 Is this image a 1D FFT image in X direction?
void set_complex_x (bool is_complex_x)
 Marks this image a 1D FFT image in X direction.
bool is_flipped () const
 Is this image flipped?
void set_flipped (bool is_flipped)
 Mark this image as flipped.
bool is_ri () const
 Is this image a real/imaginary format complex image?
void set_ri (bool is_ri)
 Mark this image as a real/imaginary format complex image.
bool is_fftpadded () const
 Is this image already extended along x for ffts?
void set_fftpad (bool is_fftpadded)
 Mark this image as already extended along x for ffts.
bool is_fftodd () const
 Does this image correspond to a (real-space) odd nx?
void set_fftodd (bool is_fftodd)
 Mark this image as having (real-space) odd nx.
void set_nxc (int nxc)
 Set the number of complex elements along x.
int get_flags () const
void set_flags (int f)
int get_changecount () const
void set_changecount (int c)
int get_xoff () const
int get_yoff () const
int get_zoff () const
void set_xyzoff (int x, int y, int z)
void scale_pixel (float scale_factor) const
 Scale the angstrom per pixel of this image by a uniform amount Alters the EMData metadata I had to make this function public for access from the Processors (David Woolford)
string get_path () const
int get_pathnum () const
std::string get_data_pickle () const
void set_data_pickle (std::string vf)
int get_supp_pickle () const
void set_supp_pickle (int i)
vector< Vec3i > mask_contig_region (const float &val, const Vec3i &seed)
float get_amplitude_thres (float thres)
 return the FFT amplitude which is greater than thres %
void set_attr_dict_explicit (const Dict &new_dict)
 Make the attributes of this EMData exactly equal to the argument dictionary Originally introduced because set_attr_dict does automatic resizing, which is undersirable in some circumstances.

Function Documentation

float calc_center_density ( )

Calculates the density value at the peak of the image histogram, sort of like the mode of the density.

Returns:
The density value at the peak of the image histogram.
FloatPoint calc_center_of_mass ( const float  threshold = 0)

Calculate the center of mass with a threshold (Default 0, so only positive values are considered)

Author:
Steve Ludtke
Date:
Fri Jun 6th 2008
vector<Pixel> calc_highest_locations ( float  threshold) const

Calculate and return a sorted list of pixels whose values are above a specified threshold.

The pixels are sorted from high to low.

Parameters:
thresholdThe specified pixel value. Returned pixels should have higher values than it.
Returns:
A sorted list of pixels with their values, and locations. Their values are higher than threshold.
size_t calc_max_index ( ) const

Calculates the index of maximum-value pixel when assuming all pixels are in a 1D array.

Returns:
Index of the maximum-value pixel.
IntPoint calc_max_location ( ) const

Calculates the coordinates of the maximum-value pixel.

Returns:
The coordinates of the maximum-value pixel.
IntPoint calc_max_location_wrap ( const int  maxshiftx = -1,
const int  maxshifty = -1,
const int  maxshiftz = -1 
)

Calculates the wrapped coordinates of the maximum value This function is useful in the context of Fourier correlation you can call this function to find the correct translational shift when using calc_ccf etc.

Returns:
the wrapped coordinates of the maximum
Author:
David Woolford
Date:
Fri Jun 6th 2008
vector<float> calc_max_location_wrap_intp ( const int  maxshiftx = -1,
const int  maxshifty = -1,
const int  maxshiftz = -1 
)

Calculates the wrapped coordinates of the maximum value, and uses quadration intp to subpixel prec This function is useful in the context of Fourier correlation you can call this function to find the correct translational shift when using calc_ccf etc.

Returns:
the wrapped coordinates of the maximum
Author:
John Flanagan
Date:
Mon Mar 7th 2011
size_t calc_min_index ( ) const

Calculates the index of minimum-value pixel when assuming all pixels are in a 1D array.

Returns:
Index of the minimum-value pixel.
IntPoint calc_min_location ( ) const

Calculates the coordinates of the minimum-value pixel.

Returns:
The coordinates of the minimum-value pixel.
vector<Pixel> calc_n_highest_locations ( int  n)

Calculate and return a sorted list of N highest pixels in the map.

Parameters:
nThe number of highest value pixels should be returned.
Returns:
A sorted list of N pixels with their values, and locations.
float calc_sigma_diff ( )

Calculates sigma above and below the mean and returns the difference between them.

Returns:
The difference between sigma above and below the mean.
void clearupdate ( ) [inline]

turn off updates.

Useful to avoid wasteful recacling stats

Definition at line 153 of file emdata_metadata.h.

{
        flags &= ~EMDATA_NEEDUPD;
        changecount--;
}
void del_attr ( const string &  attr_name)

Delete the attribute from dictionary.

Parameters:
attr_namethe attribute name to be removed
void del_attr_dict ( const vector< string > &  del_keys)

Delete the attributes from the dictionary.

Parameters:
del_keysthe attrutes' names to be removed
vector<Pixel> find_pixels_with_value ( float  val)

Find pixels in the image with exactly the specified values.

Parameters:
valThe value to look for
Returns:
An array of pixels with the specified values
MCArray2D get_2dcview ( ) const

Get complex image raw pixel data in a 2D multi-array format.

The array shares the memory space with the image data.

It should be used on 2D image only.

Returns:
2D multi-array format of the raw data.
MCArray2D get_2dcview ( int  x0,
int  y0 
) const

Get complex image raw pixel data in a 2D multi-array format.

The data coordinates is translated by (x0,y0) such that array[y0][x0] points to the pixel at the origin location. the data coordiates translated by (x0,y0). The array shares the memory space with the image data.

It should be used on 2D image only.

Parameters:
x0X-axis translation amount.
y0Y-axis translation amount.
Returns:
2D multi-array format of the raw data.
MArray2D get_2dview ( ) const

Get image raw pixel data in a 2D multi-array format.

The array shares the memory space with the image data. Notice: the subscription order is d[y][x] in Python, it's d[x][y] in C++

It should be used on 2D image only.

Returns:
2D multi-array format of the raw data.
MArray2D get_2dview ( int  x0,
int  y0 
) const

Get image raw pixel data in a 2D multi-array format.

The data coordinates is translated by (x0,y0) such that array[y0][x0] points to the pixel at the origin location. the data coordiates translated by (x0,y0). The array shares the memory space with the image data.

It should be used on 2D image only.

Parameters:
x0X-axis translation amount.
y0Y-axis translation amount.
Returns:
2D multi-array format of the raw data.
MCArray3D get_3dcview ( ) const

Get complex image raw pixel data in a 3D multi-array format.

The array shares the memory space with the image data.

It should be used on 3D image only.

Returns:
3D multi-array format of the raw data.
MCArray3D get_3dcview ( int  x0,
int  y0,
int  z0 
) const

Get complex image raw pixel data in a 3D multi-array format.

The data coordinates is translated by (x0,y0,z0) such that array[z0][y0][x0] points to the pixel at the origin location. the data coordiates translated by (x0,y0,z0). The array shares the memory space with the image data.

It should be used on 3D image only.

Parameters:
x0X-axis translation amount.
y0Y-axis translation amount.
z0Z-axis translation amount.
Returns:
3D multi-array format of the raw data.
MCArray3D* get_3dcviewptr ( ) const

Get pointer to a complex image raw pixel data in a 3D multi-array format.

The array shares the memory space with the image data.

It should be used on 3D image only.

Returns:
Pointer to a 3D multi-array format of the raw data.
MArray3D get_3dview ( ) const

Get image raw pixel data in a 3D multi-array format.

The array shares the memory space with the image data. Notice: the subscription order is d[z][y][x] in Python, it's d[x][y][z] in C++ --grant Tang

It should be used on 3D image only.

Returns:
3D multi-array format of the raw data.
MArray3D get_3dview ( int  x0,
int  y0,
int  z0 
) const

Get image raw pixel data in a 3D multi-array format.

The data coordinates is translated by (x0,y0,z0) such that array[z0][y0][x0] points to the pixel at the origin location. the data coordiates translated by (x0,y0,z0). The array shares the memory space with the image data.

It should be used on 3D image only.

Parameters:
x0X-axis translation amount.
y0Y-axis translation amount.
z0Z-axis translation amount.
Returns:
3D multi-array format of the raw data.
float get_amplitude_thres ( float  thres)

return the FFT amplitude which is greater than thres %

Exceptions:
ImageFormatExceptionIf the image is not a complex image.
Returns:
The FFT amplitude which is greater than thres %.
EMObject get_attr ( const string &  attr_name) const

The generic way to get any image header information given a header attribute name.

If the attribute does not exist, it will raise an exception.

Parameters:
attr_nameThe header attribute name.
Returns:
The attribute value.
Exceptions:
NotExistingObjectExceptionwhen attribute not exist

Referenced by EMAN::EMData::find_3d_threshold(), is_fftpadded(), is_FH(), is_flipped(), is_shuffled(), EMAN::EMData::norm_pad(), EMAN::KMeansAnalyzer::reseed(), and EMAN::KMeansAnalyzer::update_centers().

EMObject get_attr_default ( const string &  attr_name,
const EMObject &  em_obj = EMObject() 
) const

The generic way to get any image header information given a header attribute name.

If the attribute does not exist, it will return a default EMObject() object, which will be converted to None in Python. Or return any object user submit.

Parameters:
attr_nameThe header attribute name.
em_objthe default attribute to return when this attr_name not exist in attr_dict
Returns:
The attribute value, default to None.

Referenced by EMAN::EMData::rotavg().

Dict get_attr_dict ( ) const

Get the image attribute dictionary containing all the image attribute names and attribute values.

Returns:
The image attribute dictionary containing all attribute names and values.
int get_changecount ( ) const [inline]

Definition at line 984 of file emdata_metadata.h.

{
        return changecount;
}
float get_circle_mean ( )

Calculates the circular edge mean by applying a circular mask on 'this' image.

Returns:
The circular edge mean.
const float* get_const_data ( ) const [inline]

Get the image pixel density data in a 1D float array - const version of get_data.

Returns:
The image pixel density data.

Definition at line 88 of file emdata_metadata.h.

References get_data().

{ return get_data(); }
Ctf* get_ctf ( ) const
float* get_data ( ) const [inline]
vector<float> get_data_as_vector ( ) const [inline]

Get the pixel data as a vector.

Returns:
a vector containing the pixel data.

Definition at line 654 of file emdata_metadata.h.

References copy(), data, get_data(), get_size(), and v.

                                                {
        int size = get_size();
        vector<float> v(size);
        float* data = get_data();
        std::copy(data,data+size,v.begin());
        return v;
}
std::string get_data_pickle ( ) const
float get_edge_mean ( ) const

Calculates the mean pixel values around the (1 pixel) edge of the image.

Returns:
The mean pixel values around the (1 pixel) edge.
EMData* get_fft_amplitude ( )

$Id$

This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata.h", NEVER directly include this file. return the amplitudes of the FFT including the left half

Exceptions:
ImageFormatExceptionIf the image is not a complex image.
Returns:
The current FFT image's amplitude image.
EMData* get_fft_amplitude2D ( )

return the amplitudes of the 2D FFT including the left half PRB

Exceptions:
ImageFormatExceptionIf the image is not a complex image.

Returns:
The current FFT image's amplitude image.
EMData* get_fft_phase ( )

return the phases of the FFT including the left half

Exceptions:
ImageFormatExceptionIf the image is not a complex image.
Returns:
The current FFT image's phase image.
int get_flags ( ) const [inline]

Definition at line 974 of file emdata_metadata.h.

{
        return flags;
}
int get_ndim ( ) const [inline]
string get_path ( ) const [inline]

Definition at line 1023 of file emdata_metadata.h.

{
        return path;
}
int get_pathnum ( ) const [inline]

Definition at line 1028 of file emdata_metadata.h.

{
        return pathnum;
}
size_t get_size ( ) const [inline]

Get the number of allocated floats in the image (nx*ny*nz)

Returns:
nx*ny*nz

Definition at line 646 of file emdata_metadata.h.

References nx, and ny.

Referenced by get_data_as_vector().

{
        return (size_t)nx*(size_t)ny*(size_t)nz;
}
int get_supp_pickle ( ) const
Transform get_transform ( ) const [inline]

Get the 3D orientation of 'this' image.

Returns:
The 3D orientation of 'this' image.

Definition at line 323 of file emdata_metadata.h.

{
        Dict rotation_dict;
        rotation_dict["type"] = "eman";
        rotation_dict["alt"] = attr_dict["euler_alt"];
        rotation_dict["az"] = attr_dict["euler_az"];
        rotation_dict["phi"] = attr_dict["euler_phi"];

        Transform trans;
        trans.to_identity();
        trans.set_rotation(rotation_dict);

        return trans;
}
Vec3f get_translation ( ) const [inline]

Get 'this' image's translation vector from the original location.

Returns:
'this' image's translation vector from the original location.

Definition at line 292 of file emdata_metadata.h.

{
        return all_translation;
}
int get_xoff ( ) const [inline]

Definition at line 994 of file emdata_metadata.h.

{
        return xoff;
}
int get_xsize ( ) const [inline]
int get_yoff ( ) const [inline]

Definition at line 999 of file emdata_metadata.h.

{
        return yoff;
}
int get_ysize ( ) const [inline]
int get_zoff ( ) const [inline]

Definition at line 1004 of file emdata_metadata.h.

{
        return zoff;
}
int get_zsize ( ) const [inline]
bool has_attr ( const string &  key) const [inline]

Ask if the header has a particular attribute.

Parameters:
keythe header attribute name
Returns:
whether or not the header has the name as a key/value entry

Definition at line 573 of file emdata_metadata.h.

Referenced by has_ctff(), is_fftpadded(), is_FH(), and is_shuffled().

                                              {
        return attr_dict.has_key(key);
}
bool has_ctff ( ) const [inline]

check whether the image physical file has the CTF info or not.

Returns:
True if it has the CTF information. Otherwise, false.

Definition at line 162 of file emdata_metadata.h.

References has_attr().

{
        if (this->has_attr("ctf")) {
                return true;
        }
        else {
                return false;
        }
}
bool is_complex ( ) const [inline]
bool is_complex_x ( ) const [inline]

Is this image a 1D FFT image in X direction?

Returns:
Whether this image is a 1D FFT image in X direction.

Definition at line 796 of file emdata_metadata.h.

{
        if(attr_dict.has_key("is_complex_x")) {
                if (int(attr_dict["is_complex_x"])) {
                        return true;
                }
                else {
                        return false;
                }
        }
        else {
                return false;
        }
}
bool is_fftodd ( ) const [inline]

Does this image correspond to a (real-space) odd nx?

Returns:
Whether this image has a (real-space) odd nx.

Definition at line 933 of file emdata_metadata.h.

Referenced by EMAN::EMData::center_origin_fft(), EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::do_fft(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::do_ift(), EMAN::EMData::do_ift_inplace(), EMAN::EMData::filter_by_image(), EMAN::EMData::fouriergridrot2d(), EMAN::EMData::fouriergridrot_shift2d(), EMAN::EMData::nn_SSNR(), EMAN::EMData::nn_SSNR_ctf(), EMAN::EMData::replace_amplitudes(), EMAN::FourierReconstructor::setup(), EMAN::FourierReconstructorSimple2D::setup(), and EMAN::FourierReconstructor::setup_seed().

{
        if(flags & EMDATA_FFTODD) {
                return true;
        }
        else if( attr_dict.has_key("is_fftodd") && (int)attr_dict["is_fftodd"] == 1 ) {
                return true;
        }
        else {
                return false;
        }
}
bool is_fftpadded ( ) const [inline]

Is this image already extended along x for ffts?

Returns:
Whether this image is extended along x for ffts.

Definition at line 900 of file emdata_metadata.h.

References get_attr(), and has_attr().

Referenced by EMAN::EMData::do_fft(), and EMAN::EMData::do_fft_inplace().

{
        if (flags & EMDATA_PAD) {
                return true;
        }

        if(has_attr("is_fftpad")) {
                return get_attr("is_fftpad");
        }

        return false;

}
bool is_FH ( ) const [inline]

Is this a FH image?

Returns:
Whether this is a FH image or not.

Definition at line 700 of file emdata_metadata.h.

References get_attr(), and has_attr().

{  //     PRB
        if (flags & EMDATA_FH) {
                return true;
        }

        if(has_attr("is_fh")) {
                return get_attr("is_fh");
        }

        return false;
}
bool is_flipped ( ) const [inline]

Is this image flipped?

Returns:
Whether this image is flipped or not.

Definition at line 830 of file emdata_metadata.h.

References get_attr().

{
        if (flags & EMDATA_FLIP) { //keep here for back compatibility
                return true;
        }

        if(attr_dict.has_key("is_flipped")) {
                if(get_attr("is_flipped")) {
                        return true;
                }
        }

        return false;

}
bool is_real ( ) const [inline]

Is this a real image?

Returns:
Whether this is image is real (not complex) or not.

Definition at line 736 of file emdata_metadata.h.

References is_complex().

{
        return !is_complex();
}
bool is_ri ( ) const [inline]

Is this image a real/imaginary format complex image?

Returns:
Whether this image is real/imaginary format complex image.

Definition at line 866 of file emdata_metadata.h.

Referenced by EMAN::EMData::ap2ri(), EMAN::EMData::center_origin_fft(), EMAN::EMData::do_ift(), EMAN::EMData::do_ift_inplace(), EMAN::EMData::ri2ap(), and EMAN::EMData::ri2inten().

{
        if(attr_dict.has_key("is_complex_ri")) {
                if (int(attr_dict["is_complex_ri"])) {
                        return true;
                }
                else {
                        return false;
                }
        }
        else {
                return false;
        }
}
bool is_shuffled ( ) const [inline]

Has this image been shuffled?

Returns:
Whether this image has been shuffled to put origin in the center.

Definition at line 683 of file emdata_metadata.h.

References get_attr(), and has_attr().

Referenced by EMAN::EMData::fft_shuffle(), EMAN::EMData::fouriergridrot2d(), and EMAN::EMData::fouriergridrot_shift2d().

{  //     PRB
        if (flags & EMDATA_SHUFFLE) {
                return true;
        }

        if(has_attr("is_shuffled")) {
                return get_attr("is_shuffled");
        }

        return false;
}
vector<Vec3i> mask_contig_region ( const float &  val,
const Vec3i &  seed 
)
void read_data ( string  fsp,
size_t  loc,
const Region *  area = 0,
const int  file_nx = 0,
const int  file_ny = 0,
const int  file_nz = 0 
)

Read the image pixel data in native byte order from a disk file.

The image should already have the correct dimensions.

Parameters:
fspThe filename to read the image data from
locLocation to seek to in the file before writing (size_t)
areaThe image region you want to read, default 0 means read the whole image
file_nxImage x size.
file_nyImage y size.
file_nzImage z size.
Author:
Steve Ludtke
Date:
Mon Jun 23, 2008
void scale_pixel ( float  scale_factor) const

Scale the angstrom per pixel of this image by a uniform amount Alters the EMData metadata I had to make this function public for access from the Processors (David Woolford)

Author:
Unknown
void set_attr ( const string &  key,
EMObject  val 
)

Set a header attribute's value.

Parameters:
keyThe header attribute name.
valThe attribute value.

Referenced by EMAN::KMeansAnalyzer::analyze(), EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::ri2inten(), set_fftodd(), set_fftpad(), set_FH(), set_flipped(), and set_shuffled().

void set_attr_dict ( const Dict &  new_dict)

Merge the new values with the existing dictionary.

Parameters:
new_dictThe new attribute dictionary.
void set_attr_dict_explicit ( const Dict &  new_dict) [private]

Make the attributes of this EMData exactly equal to the argument dictionary Originally introduced because set_attr_dict does automatic resizing, which is undersirable in some circumstances.

Parameters:
new_dictThe attribute dictionary that will become this image's attribute dictionary.
void set_attr_python ( const string &  key,
EMObject  val 
)

Set a header attribute's value from Python.

Parameters:
keyThe header attribute name.
valThe attribute value.
void set_changecount ( int  c) [inline]

Definition at line 989 of file emdata_metadata.h.

{
        changecount = c;
}
void set_complex ( bool  is_complex) [inline]

Mark this image as a complex image.

Parameters:
is_complexIf true, a complex image. If false, a real image.

Definition at line 781 of file emdata_metadata.h.

Referenced by EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::do_ift_inplace(), and EMAN::Util::TwoDTestFunc().

{
        if (is_complex) {
                attr_dict["is_complex"] = int(1);
        }
        else {
                attr_dict["is_complex"] = int(0);
        }
}
void set_complex_size ( int  nx,
int  ny = 1,
int  nz = 1 
)

Resize 'this' complex image.

Parameters:
nxx size of this image.
nyy size of this image.
nzz size of this image.

Definition at line 396 of file emdata_metadata.h.

References ny, and set_size().

                                                  {
        set_size(nx*2, ny, nz);
}
void set_complex_x ( bool  is_complex_x) [inline]

Marks this image a 1D FFT image in X direction.

Parameters:
is_complex_xIf true, a 1D FFT image in X direction; If false, not such an image.

Definition at line 816 of file emdata_metadata.h.

Referenced by EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::do_fft_inplace(), and EMAN::EMData::do_ift_inplace().

{
        if (is_complex_x) {
                attr_dict["is_complex_x"] = int(1);
        }
        else {
                attr_dict["is_complex_x"] = int(0);
        }
}
void set_ctf ( Ctf *  ctf)

Set the CTF parameter of this image.

Parameters:
ctfThe CTF parameter object.
void set_data ( float *  data,
const int  x,
const int  y,
const int  z 
) [inline]

Set the data explicitly data pointer must be allocated using malloc!

Parameters:
dataa pointer to the pixel data which is stored in memory. Takes possession
xthe number of pixels in the x direction
ythe number of pixels in the y direction
zthe number of pixels in the z direction

Definition at line 97 of file emdata_metadata.h.

References data, nx, ny, rdata, update(), x, and y.

                                                                         {
        if (rdata) { EMUtil::em_free(rdata); rdata = 0; }
#ifdef EMAN2_USING_CUDA
        //cout << "set data" << endl;
//      free_cuda_memory();
#endif
        rdata = data;
        nx = x; ny = y; nz = z;
        nxy = nx*ny;
        nxyz = (size_t)nx*ny*nz;
        update();
}
void set_data ( float *  data) [inline]

Definition at line 110 of file emdata_metadata.h.

References data, and rdata.

                                  {
        rdata = data;
}
void set_data_pickle ( std::string  vf)
void set_fftodd ( bool  is_fftodd) [inline]

Mark this image as having (real-space) odd nx.

Parameters:
is_fftoddIf true, mark as nx odd; If false, mark as nx not odd.

Definition at line 951 of file emdata_metadata.h.

References set_attr().

Referenced by EMAN::EMData::depad(), EMAN::EMData::depad_corner(), and EMAN::EMData::do_fft_inplace().

{
        if (is_fftodd) {
                set_attr("is_fftodd", int(1));
        }
        else {
                set_attr("is_fftodd", int(0));
        }
}
void set_fftpad ( bool  is_fftpadded) [inline]

Mark this image as already extended along x for ffts.

Parameters:
is_fftpaddedIf true, mark as padded along x; If false, mark as not padded along x.

Definition at line 919 of file emdata_metadata.h.

References set_attr().

Referenced by EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::do_fft_inplace(), and EMAN::EMData::do_ift_inplace().

{
        if (is_fftpadded) {
                set_attr("is_fftpad", int(1));
        }
        else {
                set_attr("is_fftpad", int(0));
        }
}
void set_FH ( bool  is_FH) [inline]

Mark this complex image as a FH image.

Parameters:
is_FHIf true, a FH image. If false, not a FH image.

Definition at line 764 of file emdata_metadata.h.

References set_attr().

{ // PRB
        if (is_FH) {
//              flags |=  EMDATA_FH;
                set_attr("is_fh", (int)1);
        }
        else {
//              flags &= ~EMDATA_FH;
                set_attr("is_fh", (int)0);
        }
}
void set_flags ( int  f) [inline]

Definition at line 979 of file emdata_metadata.h.

{
        flags = f;
}
void set_flipped ( bool  is_flipped) [inline]

Mark this image as flipped.

Parameters:
is_flippedIf true, mark this image as flipped; If false, mark this image as not flipped.

Definition at line 851 of file emdata_metadata.h.

References set_attr().

{
        if (is_flipped) {
                set_attr("is_flipped", (int)1);
        }
        else {
                set_attr("is_flipped", (int)0);
        }
}
void set_nxc ( int  nxc) [inline]

Set the number of complex elements along x.

Parameters:
nxcis the number of complex elements along x.

Definition at line 965 of file emdata_metadata.h.

{
        attr_dict["nxc"] = nxc;
}
void set_path ( const string &  new_path) [inline]

Set the path.

Parameters:
new_pathThe new path.

Definition at line 404 of file emdata_metadata.h.

{
        path = new_path;
}
void set_pathnum ( int  n) [inline]

Set the number of paths.

Parameters:
nThe number of paths.

Definition at line 413 of file emdata_metadata.h.

{
        pathnum = n;
}
void set_ri ( bool  is_ri) [inline]

Mark this image as a real/imaginary format complex image.

Parameters:
is_riIf true, mark as real/imaginary format; If false, mark as amp/phase format.

Definition at line 886 of file emdata_metadata.h.

Referenced by EMAN::EMData::ap2ri(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::do_ift_inplace(), EMAN::EMData::ri2ap(), and EMAN::Util::TwoDTestFunc().

{
        if (is_ri) {
                attr_dict["is_complex_ri"] = int(1);
        }
        else {
                attr_dict["is_complex_ri"] = int(0);
        }
}
void set_rotation ( const Transform &  t3d) [inline]

Define the 3D orientation of this particle Orientation information is extracted from a Transform object and stored internally in EMAN (az,alt,phi) format.

Parameters:
t3da Transform object containing the particle orientation

Definition at line 359 of file emdata_metadata.h.

{
        Dict d = t3d.get_rotation("eman");
        attr_dict["orientation_convention"] = "EMAN";
        attr_dict["euler_alt"] = (float) d["alt"];
        attr_dict["euler_az"] = (float) d["az"];
        attr_dict["euler_phi"] = (float) d["phi"];;
}
void set_rotation ( float  az,
float  alt,
float  phi 
) [inline]

Define the 3D orientation of this particle, also used to indicate relative rotations for reconstructions.

Parameters:
az'az' Euler angle in EMAN convention.
alt'alt' Euler angle in EMAN convention.
phi'phi' Euler angle in EMAN convention.

Definition at line 345 of file emdata_metadata.h.

References phi.

{
    attr_dict["orientation_convention"] = "EMAN";
        attr_dict["euler_alt"]=alt;
        attr_dict["euler_az"]=az;
        attr_dict["euler_phi"]=phi;
}
void set_shuffled ( bool  is_shuffled) [inline]

Mark this image as a shuffled image.

Parameters:
is_shuffledIf true, a shuffled image. If false, not a shuffled image.

Definition at line 746 of file emdata_metadata.h.

References set_attr().

Referenced by EMAN::EMData::fft_shuffle().

{ // PRB
        if (is_shuffled) {
//              printf("entered correct part of set_shuffled \n");
//              flags |=  EMDATA_SHUFFLE;
                set_attr("is_shuffled", (int)1);
        }
        else {
//              flags &= ~EMDATA_SHUFFLE;
                set_attr("is_shuffled", (int)0);
        }
}
void set_size ( int  nx,
int  ny = 1,
int  nz = 1,
bool  noalloc = false 
)

Resize this EMData's main board memory pointer.

Parameters:
nxx size of this image.
nyy size of this image.
nzz size of this image.
Exceptions:
BadAllocExceptionif memory allocation returns a null pointer

Referenced by EMAN::EMData::bispecRotTransInvN(), EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::do_fft_inplace(), and set_complex_size().

void set_supp_pickle ( int  i)
void set_translation ( float  dx,
float  dy,
float  dz 
) [inline]

Set 'this' images' translation vector from the original location.

Parameters:
dxThe translation distance in x direction.
dyThe translation distance in y direction.
dzThe translation distance in z direction.

Definition at line 314 of file emdata_metadata.h.

{
        all_translation = Vec3f(dx, dy, dz);
}
void set_translation ( const Vec3f &  t) [inline]

Set 'this' images' translation vector from the original location.

Parameters:
tThe new translation vector.

Definition at line 302 of file emdata_metadata.h.

References t.

{
        all_translation = t;
}
void set_xyzoff ( int  x,
int  y,
int  z 
) [inline]

Definition at line 1009 of file emdata_metadata.h.

References x, and y.

{
        xoff = x;
        yoff = y;
        zoff = z;
}
void update ( ) [inline]
void write_data ( string  fsp,
size_t  loc,
const Region *const  area = 0,
const int  file_nx = 0,
const int  file_ny = 0,
const int  file_nz = 0 
)

Dump the image pixel data in native byte order to a disk file.

Parameters:
fspThe filename to write the image data to
locLocation to seek to in the file before writing (size_t)
areaThe image region you want to read, default 0 means read the whole image
file_nxImage x size.
file_nyImage y size.
file_nzImage z size.
Author:
Steve Ludtke
Date:
Mon Jun 23, 2008