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

Go to the source code of this file.

Functions

EMData * copy () const
 $Id$
EMData * copy_head () const
 Make an image with a copy of the current image's header.
void add (float f, int keepzero=0)
 add a number to each pixel value of the image.
void add (const EMData &image)
 add a same-size image to this image pixel by pixel.
void addsquare (const EMData &image)
 add the squared value of each pixel from a same-size image to this image.
void sub (float f)
 subtract a float number to each pixel value of the image.
void sub (const EMData &image)
 subtract a same-size image from this image pixel by pixel.
void subsquare (const EMData &image)
 subtract the squared value of each pixel from a same-size image to this image.
void mult (int n)
 multiply an integer number to each pixel value of the image.
void mult (float f)
 multiply a float number to each pixel value of the image.
void mult (const EMData &image, bool prevent_complex_multiplication=false)
 multiply each pixel of this image with each pixel of some other same-size image.
void mult_complex_efficient (const EMData &em, const int radius)
void div (float f)
 make each pixel value divided by a float number.
void div (const EMData &image)
 make each pixel value divided by pixel value of another same-size image.
void to_zero ()
 Set all the pixel value = 0.
void to_one ()
 set all the pixel values = 1.
void to_value (const float &value)
 set all the pixel values to a value.
float dot (EMData *with)
 Dot product 2 images.
EMData * get_row (int row_index) const
 Get one row of a 1D/2D image.
void set_row (const EMData *data, int row_index)
 Set one row of a 1D/2D image.
EMData * get_col (int col_index) const
 Get one column of a 2D images.
void set_col (const EMData *data, int col_index)
 Set one column of a 2D image.
float get_value_at (int x, int y, int z) const
 Get the pixel density value at coordinates (x,y,z).
float get_value_at_index (int i)
 Get the pixel density value at index i.
float get_value_at (int x, int y) const
 Get the pixel density value at coordinates (x,y).
float get_value_at (size_t i) const
 Get the pixel density value given an index 'i' assuming the pixles are stored in a 1D array.
std::complex< float > get_complex_at (const int &x, const int &y) const
 Get complex<float> value at x,y.
std::complex< float > get_complex_at (const int &x, const int &y, const int &z) const
 Get complex<float> value at x,y,z.
size_t get_complex_index (const int &x, const int &y, const int &z) const
 Get complex<float> index for coords x,y,z.
size_t get_complex_index (int x, int y, int z, const int &subx0, const int &suby0, const int &subz0, const int &fullnx, const int &fullny, const int &fullnz) const
size_t get_complex_index_fast (const int &x, const int &y, const int &z) const
void set_complex_at (const int &x, const int &y, const std::complex< float > &val)
 Set complex<float> value at x,y.
void set_complex_at (const int &x, const int &y, const int &z, const std::complex< float > &val)
 Set complex<float> value at x,y,z.
size_t add_complex_at (const int &x, const int &y, const int &z, const std::complex< float > &val)
 Add complex<float> value at x,y,z.
size_t add_complex_at_fast (const int &x, const int &y, const int &z, const std::complex< float > &val)
size_t add_complex_at (int x, int y, int z, const int &subx0, const int &suby0, const int &subz0, const int &fullnx, const int &fullny, const int &fullnz, const std::complex< float > &val)
 Add complex<float> value at x,y,z assuming that 'this' is a subvolume from a larger virtual volume.
float get_value_at_wrap (int x, int y, int z) const
 Get the pixel density value at coordinates (x,y,z).
float get_value_at_wrap (int x, int y) const
 Get the pixel density value at coordinates (x,y).
float get_value_at_wrap (int x) const
 Get the pixel density value at coordinates (x).
float sget_value_at (Vec3i v)
 Vec3i version of save routines below.
float sget_value_at (int x, int y, int z) const
 A safer, slower way to get the pixel density value at coordinates (x,y,z).
float sget_value_at (int x, int y) const
 A safer, slower way to get the pixel density value at coordinates (x,y).
float sget_value_at (size_t i) const
 A safer, slower way to get the pixel density value given an index 'i' assuming the pixles are stored in a 1D array.
float sget_value_at_interp (float x, float y) const
 Get pixel density value at interpolation of (x,y).
float sget_value_at_interp (float x, float y, float z) const
 Get the pixel density value at interpolation of (x,y,z).
void set_value_at (Vec3i loc, float val)
 set_value_at with Vec3i
void set_value_at (int x, int y, int z, float v)
 Set the pixel density value at coordinates (x,y,z).
void set_value_at_fast (int x, int y, int z, float v)
 Set the pixel density value at coordinates (x,y,z).
void set_value_at_index (int i, float v)
 Set the pixel density value at index.
void set_value_at (int x, int y, float v)
 Set the pixel density value at coordinates (x,y).
void set_value_at_fast (int x, int y, float v)
 Set the pixel density value at coordinates (x,y).
void set_value_at (int x, float v)
 Set the pixel density value at coordinate (x).
void set_value_at_fast (int x, float v)
 Set the pixel density value at coordinate (x).
void free_memory ()
 Free memory associated with this EMData Called in destructor and in assignment operator.
void free_rdata ()
 Free rdata memory associated with this EMData Called in CUDA.
EMData & operator+= (float n)
EMData & operator-= (float n)
EMData & operator*= (float n)
EMData & operator/= (float n)
EMData & operator+= (const EMData &em)
EMData & operator-= (const EMData &em)
EMData & operator*= (const EMData &em)
EMData & operator/= (const EMData &em)
bool operator== (const EMData &that) const
bool equal (const EMData &that) const
 compare the equality of two EMData object based on their pixel values
float & operator() (const int ix, const int iy, const int iz) const
 Overload operator() for array indexing.
float & operator() (const int ix, const int iy) const
float & operator() (const size_t ix) const
void set_array_offsets (const int xoff_=0, const int yoff_=0, const int zoff_=0)
 Set the array offsets.
void set_array_offsets (vector< int > offsets)
vector< int > get_array_offsets ()
std::complex< float > & cmplx (const int ix, const int iy, const int iz)
 Return reference to complex elements.
std::complex< float > & cmplx (const int ix, const int iy)
std::complex< float > & cmplx (const int ix)
EMData * power (int n) const
 return a image to the power of n
EMData * sqrt () const
 return square root of current image
EMData * log () const
 return natural logarithm image for a image
EMData * log10 () const
 return base 10 logarithm image for a image
EMData * real () const
 return real part of a complex image as a real image format, if this image is a real image, return a copy of this image.
EMData * imag () const
 return imaginary part of a complex image as a real image format.
EMData * absi () const
 For a real image, it returns a same size image with abs() of each pixel.
EMData * amplitude () const
 return amplitude part of a complex image as a real image format
EMData * phase () const
 return phase part of a complex image as a real image format
EMData * real2complex (float img=0.0f) const
 create a complex image from a real image, this complex image is in real/imaginary format

Function Documentation

EMData* absi ( ) const

For a real image, it returns a same size image with abs() of each pixel.

For a complex image, it returns a image in size (nx/2,ny,nz), the pixel value output[i]=sqrt(input[i]*input[i]+input[i+1]*input[i+1])

Exceptions:
InvalidCallExceptionthis function call require a complex image in real/imaginary format.
void add ( float  f,
int  keepzero = 0 
)

add a number to each pixel value of the image.

Image may be real or complex.

Parameters:
fThe number added to 'this' image.
keepzeroIf set will not modify pixels that are exactly zero
void add ( const EMData &  image)

add a same-size image to this image pixel by pixel.

Parameters:
imageThe image added to 'this' image.
Exceptions:
ImageFormatExceptionIf the 2 images are not same size.
size_t add_complex_at ( const int &  x,
const int &  y,
const int &  z,
const std::complex< float > &  val 
)

Add complex<float> value at x,y,z.

This assumes the image is a standard real/imaginary image with the complex origin in the first memory location. If you take the fft of a real nx x ny x nz image, a nx+2 x ny x nz image will be produced, and values using this function can go from -nx/2 to nx/2 and -ny/2 to ny/2. It will automatically deal with wraparound and complex conjugate issues for -x. It will return the index into the float array at which the complex began, or nx*ny*nz if out of range

Parameters:
xx coordinate
yy coordinate
zz coordinate
valcomplex<float> value to set
Returns:
The complex pixel at x,y
size_t add_complex_at ( int  x,
int  y,
int  z,
const int &  subx0,
const int &  suby0,
const int &  subz0,
const int &  fullnx,
const int &  fullny,
const int &  fullnz,
const std::complex< float > &  val 
)

Add complex<float> value at x,y,z assuming that 'this' is a subvolume from a larger virtual volume.

Requires that parameters often stored in the header as: subvolume_x0,y0,z0 and subvolume_full_nx,ny,nz be passed in as parameters. Otherwise similar to add_complex_at. It will return the index into the subvolume float array at which the complex began, or nx*ny*nz if out of range

Parameters:
xx coordinate
yy coordinate
zz coordinate
valcomplex<float> value to set
Returns:
The complex pixel at x,y
size_t add_complex_at_fast ( const int &  x,
const int &  y,
const int &  z,
const std::complex< float > &  val 
) [inline]

Definition at line 337 of file emdata_core.h.

References nx, ny, rdata, and y.

                                                                                                       {
//if (x>=nx/2 || y>ny/2 || z>nz/2 || x<=-nx/2 || y<-ny/2 || z<-nz/2) return nxyz;

size_t idx;
if (x<0) {
        idx=-x*2+(y<=0?-y:ny-y)*(size_t)nx+(z<=0?-z:nz-z)*(size_t)nxy;
        rdata[idx]+=(float)val.real();
        rdata[idx+1]-=(float)val.imag();
        return idx;
}

idx=x*2+(y<0?ny+y:y)*(size_t)nx+(z<0?nz+z:z)*(size_t)nxy;
rdata[idx]+=(float)val.real();
rdata[idx+1]+=(float)val.imag();

return idx;
}
void addsquare ( const EMData &  image)

add the squared value of each pixel from a same-size image to this image.

Parameters:
imageThe image whose square is added to 'this' image.
Exceptions:
ImageFormatExceptionIf the 2 images are not same size.
EMData* amplitude ( ) const

return amplitude part of a complex image as a real image format

Returns:
EMData * a real image which is the amplitude part of this image
Exceptions:
InvalidCallExceptionif this image is a real image or is in real/imaginary format
std::complex<float>& cmplx ( const int  ix,
const int  iy,
const int  iz 
)
std::complex<float>& cmplx ( const int  ix,
const int  iy 
)

Definition at line 690 of file emdata_core.h.

References get_data(), nx, ny, and OutofRangeException.

                                                     {
        ptrdiff_t pos = 2*(ix-xoff)+(iy-yoff)*nx;
#ifdef BOUNDS_CHECKING
        if (pos < 0 || pos >= (size_t)nx*ny*nz)
                throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
#endif // BOUNDS_CHECKING
        float* begin = get_data() + pos;
        return *(reinterpret_cast<std::complex<float>* >(begin));
}
std::complex<float>& cmplx ( const int  ix)

Definition at line 701 of file emdata_core.h.

References get_data(), nx, ny, and OutofRangeException.

                                       {
        ptrdiff_t pos = 2*(ix-xoff);
#ifdef BOUNDS_CHECKING
        if (pos < 0 || pos >= (size_t)nx*ny*nz)
                throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
#endif // BOUNDS_CHECKING
        float* begin = get_data() + pos;
        return *(reinterpret_cast<std::complex<float>* >(begin));
}
EMData* copy ( ) const
EMData* copy_head ( ) const
void div ( float  f)

make each pixel value divided by a float number.

Parameters:
fThe float number 'this' image divided by.

Referenced by EMAN::Util::calc_least_square_fit(), and EMAN::EMAN2Ctf::compute_1d().

void div ( const EMData &  image)

make each pixel value divided by pixel value of another same-size image.

Parameters:
imageThe image 'this' image divided by.
Exceptions:
ImageFormatExceptionIf the 2 images are not same size.
float dot ( EMData *  with)

Dot product 2 images.

The 2 images must be of same size. If 'evenonly' is true, only calculates pixels with even positions assuming all pixels are in a single array. If 'evenonly' is false, calculates all pixels. Shortcut for cmp("dot")

Parameters:
withThe image to do dot product with.
Exceptions:
NullPointerExceptionif with is a NULL image.
Returns:
The dot product result.

Referenced by EMAN::Util::windowdot().

bool equal ( const EMData &  that) const

compare the equality of two EMData object based on their pixel values

void free_memory ( )

Free memory associated with this EMData Called in destructor and in assignment operator.

void free_rdata ( )

Free rdata memory associated with this EMData Called in CUDA.

vector<int> get_array_offsets ( )
EMData* get_col ( int  col_index) const

Get one column of a 2D images.

Parameters:
col_indexIndex of the column.
Exceptions:
ImageDimensionExceptionIf this image is not 2D.
Returns:
A 1D image with the column data.

Referenced by LBD_Cart().

std::complex<float> get_complex_at ( const int &  x,
const int &  y 
) const

Get complex<float> value at x,y.

This assumes the image is a standard real/imaginary image with the complex origin in the first memory location. If you take the fft of a real nx x ny image, a nx+2 x ny image will be produced, and values using this function can go from -nx/2-1 to nx/2+1 and -ny/2 to ny/2. It will automatically deal with wraparound and complex conjugate issues for -x. This function differs from cmplx() which will interpret x,y directly as pixel coordinates

Parameters:
xx coordinate
yy coordinate
Returns:
The complex pixel at x,y
std::complex<float> get_complex_at ( const int &  x,
const int &  y,
const int &  z 
) const

Get complex<float> value at x,y,z.

This assumes the image is a standard real/imaginary image with the complex origin in the first memory location. If you take the fft of a real nx x ny x nz image, a nx+2 x ny x nz image will be produced, and values using this function can go from -nx/2 to nx/2 and -ny/2 to ny/2. It will automatically deal with wraparound and complex conjugate issues for -x. This function differs from cmplx() which will interpret x,y directly as pixel coordinates

Parameters:
xx coordinate
yy coordinate
zz coordinate
Returns:
The complex pixel at x,y
size_t get_complex_index ( const int &  x,
const int &  y,
const int &  z 
) const

Get complex<float> index for coords x,y,z.

This assumes the image is a standard real/imaginary image with the complex origin in the first memory location. If you take the fft of a real nx x ny x nz image, a nx+2 x ny x nz image will be produced, and values using this function can go from -nx/2 to nx/2 and -ny/2 to ny/2. It will automatically deal with wraparound and complex conjugate issues for -x. Note that if a pixel is accessed at this location, a complex conjugate may be required if x<0, and this fact is not returned.

Parameters:
xx coordinate
yy coordinate
zz coordinate
Returns:
The complex pixel at x,y
size_t get_complex_index ( int  x,
int  y,
int  z,
const int &  subx0,
const int &  suby0,
const int &  subz0,
const int &  fullnx,
const int &  fullny,
const int &  fullnz 
) const
size_t get_complex_index_fast ( const int &  x,
const int &  y,
const int &  z 
) const [inline]

Definition at line 285 of file emdata_core.h.

References nx, ny, and y.

                                                                                   {
//      if (abs(x)>=nx/2 || abs(y)>ny/2 || abs(z)>nz/2) return nxyz;
        if (x<0) {
                return (size_t)x*-2+(y<=0?-y:ny-y)*(size_t)nx+(z<=0?-z:nz-z)*(size_t)nxy;
        }
        return x*2+(y<0?ny+y:y)*(size_t)nx+(z<0?nz+z:z)*(size_t)nxy;
}
EMData* get_row ( int  row_index) const

Get one row of a 1D/2D image.

Parameters:
row_indexIndex of the row.
Exceptions:
ImageDimensionExceptionIf this image is 3D.
Returns:
A 1D image with the row data.

Referenced by recons3d_HyBR_mpi_Cart().

float get_value_at ( int  x,
int  y,
int  z 
) const [inline]

Get the pixel density value at coordinates (x,y,z).

The validity of x, y, and z is not checked.

Parameters:
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.
Returns:
The pixel density value at coordinates (x,y,z).

Definition at line 204 of file emdata_core.h.

References get_data(), and nx.

Referenced by EMAN::EMData::bispecRotTransInvDirect(), EMAN::EMData::bispecRotTransInvN(), EMAN::Util::curhelixshiftali(), EMAN::Util::helixshiftali(), EMAN::RotateInFSProcessor::process_inplace(), and EMAN::Util::svdcmp().

{
        return get_data()[(size_t)x + (size_t)y * (size_t)nx + (size_t)z * (size_t)nxy];
}
float get_value_at ( int  x,
int  y 
) const [inline]

Get the pixel density value at coordinates (x,y).

2D only. The validity of x, y is not checked.

Parameters:
xThe x coordinate.
yThe y coordinate.
Returns:
The pixel density value at coordinates (x,y).

Definition at line 224 of file emdata_core.h.

References get_data(), and nx.

{
        return get_data()[x + y * nx];
}
float get_value_at ( size_t  i) const [inline]

Get the pixel density value given an index 'i' assuming the pixles are stored in a 1D array.

The validity of i is not checked.

Parameters:
i1D data array index.
Returns:
The pixel density value

Definition at line 237 of file emdata_core.h.

References get_data().

{
        return get_data()[i];
}
float get_value_at_index ( int  i) [inline]

Get the pixel density value at index i.

Parameters:
aThe index.

Definition at line 212 of file emdata_core.h.

References rdata.

{
        return *(rdata + i);
}
float & get_value_at_wrap ( int  x,
int  y,
int  z 
) const

Get the pixel density value at coordinates (x,y,z).

Should only be called on 3D images - no errors are thrown Wraps pixel values if they are negative - i.e. is circulant For example, if x = -1, then the pixel at nx-1 is returned

Parameters:
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.
Returns:
The pixel density value at circulant coordinates (x,y,z).
float & get_value_at_wrap ( int  x,
int  y 
) const

Get the pixel density value at coordinates (x,y).

Should only be called on 2D images - no errors are thrown Wraps pixel values if they are negative - i.e. is circulant For example, if x = -1, then the pixel at nx-1 is returned

Parameters:
xThe x coordinate.
yThe y coordinate.
Returns:
The pixel density value at circulant coordinates (x,y).
float & get_value_at_wrap ( int  x) const

Get the pixel density value at coordinates (x).

Should only be called on 1D images - no errors are thrown Wraps pixel values if they are negative - i.e. is circulant For example, if x = -1, then the pixel at nx-1 is returned

Parameters:
xThe x coordinate.
Returns:
The pixel density value at circulant coordinates (x).
EMData* imag ( ) const

return imaginary part of a complex image as a real image format.

Returns:
a real image which is the imaginary part of this image.
Exceptions:
InvalidCallExceptionif this image is a real image
InvalidCallExceptionif this image is a complex image in amplitude/phase format

Referenced by EMAN::fourierproduct(), EMAN::periodogram(), and EMAN::EMData::real2FH().

EMData* log ( ) const
EMData* log10 ( ) const

return base 10 logarithm image for a image

Returns:
a image which is the base 10 logarithm of this image
Exceptions:
InvalidValueExceptionpixel value must be >= 0
ImageFormatExceptionreal image only

Referenced by EMAN::Processor::EMFourierFilterFunc(), main(), EMAN::SNRProcessor::process_inplace(), EMAN::LogProcessor::process_pixel(), and EMAN::NewFourierProcessor::setbutterworthdefaults().

void mult ( float  f)

multiply a float number to each pixel value of the image.

Parameters:
fThe float multiplied to 'this' image.
void mult ( const EMData &  image,
bool  prevent_complex_multiplication = false 
)

multiply each pixel of this image with each pixel of some other same-size image.

Parameters:
imageThe image multiplied to 'this' image.
prevent_complex_multiplicationif the image is complex, this flag will override complex multiplication and just multiply each pixel by the other
Exceptions:
ImageFormatExceptionIf the 2 images are not same size.
void mult ( int  n)
void mult_complex_efficient ( const EMData &  em,
const int  radius 
)
float& operator() ( const int  ix,
const int  iy,
const int  iz 
) const [inline]

Overload operator() for array indexing.

Definition at line 625 of file emdata_core.h.

References get_data(), nx, ny, and OutofRangeException.

                                                                         {
        ptrdiff_t pos = (size_t)(ix-xoff) + ((iy-yoff) + (size_t)(iz-zoff)*ny)*nx;
#ifdef BOUNDS_CHECKING
        if (pos < 0 || pos >= (size_t)nx*ny*nz) {
                throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
        }
#endif // BOUNDS_CHECKING
        return *(get_data() + pos);
}
float& operator() ( const int  ix,
const int  iy 
) const [inline]

Definition at line 635 of file emdata_core.h.

References get_data(), nx, ny, and OutofRangeException.

                                                           {
        ptrdiff_t pos = (ix - xoff) + (iy-yoff)*nx;
#ifdef BOUNDS_CHECKING
        if (pos < 0 || pos >= (size_t)nx*ny*nz)
        {
                throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
        }
#endif // BOUNDS_CHECKING
        return *(get_data() + pos);
}
float& operator() ( const size_t  ix) const [inline]

Definition at line 647 of file emdata_core.h.

References get_data(), nx, ny, and OutofRangeException.

                                                {
        ptrdiff_t pos = ix - xoff;
#ifdef BOUNDS_CHECKING
        if (pos < 0 || pos >= (size_t)nx*ny*nz)
                throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
#endif // BOUNDS_CHECKING
        return *(get_data() + pos);
}
EMData& operator*= ( float  n)
EMData& operator*= ( const EMData &  em)
EMData& operator+= ( float  n)
EMData& operator+= ( const EMData &  em)
EMData& operator-= ( float  n)
EMData& operator-= ( const EMData &  em)
EMData& operator/= ( float  n)
EMData& operator/= ( const EMData &  em)
bool operator== ( const EMData &  that) const
EMData* phase ( ) const

return phase part of a complex image as a real image format

Returns:
EMData * a real image which is the phase part of this image
Exceptions:
InvalidCallExceptionif this image is a real image or is in real/imaginary format

Referenced by EMAN::TestImageSinewaveCircular::process_inplace(), EMAN::TestImageSinewave::process_inplace(), EMAN::TestImageSphericalWave::process_inplace(), EMAN::TestImageFourierNoiseProfile::process_inplace(), EMAN::TestImageFourierNoiseGaussian::process_inplace(), and EMAN::Util::tf().

EMData* power ( int  n) const

return a image to the power of n

Parameters:
nthe power of this image
Returns:
a image which is the nth power of this image
Exceptions:
InvalidValueExceptionn must be >= 0

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), EMAN::Util::pack_complex_to_real(), and EMAN::periodogram().

EMData* real ( ) const

return real part of a complex image as a real image format, if this image is a real image, return a copy of this image.

Returns:
a real image which is the real part of this image.
EMData* real2complex ( float  img = 0.0f) const

create a complex image from a real image, this complex image is in real/imaginary format

Parameters:
imggive an artificial imaginary part
Returns:
a complex image which is generated from a real image
Exceptions:
InvalidCallExceptionthis function can not be called by complex image
void set_array_offsets ( const int  xoff_ = 0,
const int  yoff_ = 0,
const int  zoff_ = 0 
)

Set the array offsets.

Definition at line 658 of file emdata_core.h.

Referenced by EMAN::EMData::center_origin_fft(), EMAN::EMData::depad(), EMAN::EMData::depad_corner(), EMAN::EMData::divkbsinh(), EMAN::EMData::divkbsinh_rect(), EMAN::EMData::downsample(), EMAN::EMData::extract_plane(), EMAN::EMData::extract_plane_rect(), EMAN::EMData::extract_plane_rect_fast(), EMAN::EMData::extractline(), EMAN::EMData::fft_shuffle(), EMAN::EMData::fouriergridrot2d(), EMAN::EMData::fouriergridrot_shift2d(), EMAN::EMData::getconvpt2d_kbi0(), EMAN::EMData::helicise_grid(), EMAN::EMData::insert_rect_slice(), EMAN::EMData::insert_rect_slice_ctf(), EMAN::EMData::insert_rect_slice_ctf_applied(), EMAN::EMData::mult_radial(), EMAN::EMData::nn(), EMAN::EMData::nn_ctf(), EMAN::EMData::nn_ctf_applied(), EMAN::EMData::nn_ctfw(), EMAN::EMData::nn_SSNR(), EMAN::EMData::nn_SSNR_ctf(), EMAN::EMData::norm_pad(), EMAN::EMData::rot_scale_conv(), EMAN::EMData::rot_scale_conv7(), EMAN::EMData::rot_scale_conv_new(), EMAN::EMData::rot_scale_conv_new_3D(), EMAN::EMData::rot_scale_conv_new_background(), EMAN::EMData::rot_scale_conv_new_background_3D(), EMAN::EMData::rot_scale_trans(), EMAN::EMData::rot_scale_trans2D(), EMAN::EMData::rot_scale_trans2D_background(), EMAN::EMData::rot_scale_trans_background(), EMAN::EMData::rotavg(), set_array_offsets(), EMAN::EMData::symplane0(), EMAN::EMData::symplane0_ctf(), EMAN::EMData::symplane0_rect(), EMAN::EMData::symplane1(), and EMAN::EMData::symplane2().

                                                  {
        xoff=xoff_; yoff=yoff_; zoff=zoff_;
}
void set_array_offsets ( vector< int >  offsets)

Definition at line 664 of file emdata_core.h.

References set_array_offsets().

                                            {
        set_array_offsets(offsets[0],offsets[1],offsets[2]);
}
void set_col ( const EMData *  data,
int  col_index 
)

Set one column of a 2D image.

Parameters:
dataThe column image data.
col_indexIndex of the column.
Exceptions:
ImageDimensionExceptionIf this image is not 2D.
void set_complex_at ( const int &  x,
const int &  y,
const std::complex< float > &  val 
)

Set complex<float> value at x,y.

This assumes the image is a standard real/imaginary image with the complex origin in the first memory location. If you take the fft of a real nx x ny image, a nx+2 x ny image will be produced, and values using this function can go from -nx/2-1 to nx/2+1 and -ny/2 to ny/2. It will automatically deal with wraparound and complex conjugate issues for -x. This function differs from cmplx() which will interpret x,y directly as pixel coordinates

Parameters:
xx coordinate
yy coordinate
valcomplex<float> value to set
Returns:
The complex pixel at x,y
void set_complex_at ( const int &  x,
const int &  y,
const int &  z,
const std::complex< float > &  val 
)

Set complex<float> value at x,y,z.

This assumes the image is a standard real/imaginary image with the complex origin in the first memory location. If you take the fft of a real nx x ny x nz image, a nx+2 x ny x nz image will be produced, and values using this function can go from -nx/2 to nx/2 and -ny/2 to ny/2. It will automatically deal with wraparound and complex conjugate issues for -x. This function differs from cmplx() which will interpret x,y directly as pixel coordinates

Parameters:
xx coordinate
yy coordinate
zz coordinate
valcomplex<float> value to set
Returns:
The complex pixel at x,y
void set_row ( const EMData *  data,
int  row_index 
)

Set one row of a 1D/2D image.

Parameters:
dataThe row image data.
row_indexIndex of the row.
Exceptions:
ImageDimensionExceptionIf this image is 3D.
void set_value_at ( Vec3i  loc,
float  val 
) [inline]

set_value_at with Vec3i

Parameters:
loclocation
vvalue

Definition at line 465 of file emdata_core.h.

Referenced by EMAN::EMData::bispecRotTransInvDirect(), EMAN::EMData::bispecRotTransInvN(), and EMAN::RotateInFSProcessor::process_inplace().

{ set_value_at(loc[0],loc[1],loc[2],val); }
void set_value_at ( int  x,
int  y,
int  z,
float  v 
) [inline]

Set the pixel density value at coordinates (x,y,z).

This implementation does bounds checking.

Parameters:
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.
vThe pixel density value at coordinates (x,y,z).
Exceptions:
OutofRangeExceptionwehn index out of image data's range.

Definition at line 476 of file emdata_core.h.

References get_data(), nx, ny, OutofRangeException, and update().

{
        if( x>=nx || x<0 )
        {
                throw OutofRangeException(0, nx-1, x, "x dimension index");
        }
        else if( y>=ny || y<0 )
        {
                throw OutofRangeException(0, ny-1, y, "y dimension index");
        }
        else if( z>=nz || z<0 )
        {
                throw OutofRangeException(0, nz-1, z, "z dimension index");
        }
        else
        {
                get_data()[(size_t)x + (size_t)y * (size_t)nx + (size_t)z * (size_t)nxy] = v;
                update();
        }
}
void set_value_at ( int  x,
int  y,
float  v 
) [inline]

Set the pixel density value at coordinates (x,y).

2D image only.

Parameters:
xThe x coordinate.
yThe y coordinate.
vThe pixel density value at coordinates (x,y).
Exceptions:
OutofRangeExceptionwehn index out of image data's range.

Definition at line 532 of file emdata_core.h.

References get_data(), nx, ny, OutofRangeException, update(), and v.

{
        if( x>=nx || x<0 )
        {
                throw OutofRangeException(0, nx-1, x, "x dimension index");
        }
        else if( y>=ny || y<0 )
        {
                throw OutofRangeException(0, ny-1, y, "y dimension index");
        }
        else
        {
                get_data()[x + y * nx] = v;
                update();
                
        }
}
void set_value_at ( int  x,
float  v 
) [inline]

Set the pixel density value at coordinate (x).

1D image only.

Parameters:
xThe x coordinate.
vThe pixel density value at coordinate (x).
Exceptions:
OutofRangeExceptionwehn index out of image data's range.

Definition at line 572 of file emdata_core.h.

References get_data(), nx, OutofRangeException, update(), v, and x.

{
        if( x>=nx || x<0 )
        {
                throw OutofRangeException(0, nx-1, x, "x dimension index");
        }
        else
        {
                get_data()[x] = v;

                update();
        }
}
void set_value_at_fast ( int  x,
float  v 
) [inline]

Set the pixel density value at coordinate (x).

1D image only.

Parameters:
xThe x coordinate.
vThe pixel density value at coordinate (x).

Definition at line 592 of file emdata_core.h.

References get_data(), update(), v, and x.

{
        get_data()[x] = v;

        update();
}
void set_value_at_fast ( int  x,
int  y,
int  z,
float  v 
) [inline]

Set the pixel density value at coordinates (x,y,z).

The validity of x, y, and z is not checked. This implementation has no bounds checking.

Parameters:
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.
vThe pixel density value at coordinates (x,y,z).

Definition at line 507 of file emdata_core.h.

References get_data(), nx, and update().

{
        get_data()[(size_t)x + (size_t)y * (size_t)nx + (size_t)z * (size_t)nxy] = v;
        update();
}
void set_value_at_fast ( int  x,
int  y,
float  v 
) [inline]

Set the pixel density value at coordinates (x,y).

2D image only. The validity of x, y, is not checked.

Parameters:
xThe x coordinate.
yThe y coordinate.
vThe pixel density value at coordinates (x,y).

Definition at line 558 of file emdata_core.h.

References get_data(), nx, update(), and v.

{
        get_data()[x + y * nx] = v;
        update();
}
void set_value_at_index ( int  i,
float  v 
) [inline]

Set the pixel density value at index.

Parameters:
iThe index.
vThe value.

Definition at line 519 of file emdata_core.h.

References rdata.

{
        *(rdata + i) = v;
}
float sget_value_at ( int  x,
int  y,
int  z 
) const

A safer, slower way to get the pixel density value at coordinates (x,y,z).

The validity of x, y, and z is checked. If the coordinates are out of range, return 0;

Parameters:
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.
Returns:
The pixel density value at coordinates (x,y,z).
float sget_value_at ( size_t  i) const

A safer, slower way to get the pixel density value given an index 'i' assuming the pixles are stored in a 1D array.

The validity of i is checked. If i is out of range, return 0;

Parameters:
i1D data array index.
Returns:
The pixel density value
float sget_value_at ( Vec3i  v) [inline]

Vec3i version of save routines below.

Parameters:
coord

Definition at line 405 of file emdata_core.h.

{ return sget_value_at(v[0],v[1],v[2]); }
float sget_value_at ( int  x,
int  y 
) const

A safer, slower way to get the pixel density value at coordinates (x,y).

2D only. The validity of x, y is checked. If the coordinates are out of range, return 0;

Parameters:
xThe x coordinate.
yThe y coordinate.
Returns:
The pixel density value at coordinates (x,y).
float sget_value_at_interp ( float  x,
float  y 
) const

Get pixel density value at interpolation of (x,y).

The validity of x, y is checked.2D image only.

Parameters:
xThe x coordinate.
yThe y coordinate.
Returns:
The pixel density value at coordinates (x,y).
float sget_value_at_interp ( float  x,
float  y,
float  z 
) const

Get the pixel density value at interpolation of (x,y,z).

The validity of x, y, and z is checked.

Parameters:
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.
Returns:
The pixel density value at coordinates (x,y,z).
EMData* sqrt ( ) const

return square root of current image

Returns:
a image which is the square root of this image
Exceptions:
ImageFormatExceptionreal image only

Referenced by EMAN::Quaternion::abs(), EMAN::newfile_store::add_image(), EMAN::FRM2DAligner::align(), EMAN::Refine3DAlignerGrid::align(), EMAN::ShapeAnalyzer::analyze(), angle_(), areas_(), EMAN::EMData::bispecRotTransInvDirect(), EMAN::EMData::bispecRotTransInvN(), bmv_(), EMAN::Util::FakeKaiserBessel::build_I0table(), EMAN::Util::KaiserBessel::build_I0table(), EMAN::EMAN1Ctf::calc_amp1(), EMAN::EMAN1Ctf::calc_amplitude(), EMAN::XYData::calc_correlation(), EMAN::EMData::calc_fourier_shell_correlation(), EMAN::EMAN1Ctf::calc_lambda(), EMAN::MaskEdgeMeanProcessor::calc_locals(), EMAN::EMAN1Ctf::calc_noise(), EMAN::NormalizeMaskProcessor::calc_sigma(), EMAN::NormalizeUnitProcessor::calc_sigma(), EMAN::PointArray::calc_total_length(), circum_(), EMAN::Util::cluster_equalsize(), EMAN::Util::cluster_pairwise(), EMAN::Util::cml_line_in3d(), EMAN::QuadMinDotCmp::cmp(), EMAN::TomoFscCmp::cmp(), EMAN::TomoCccCmp::cmp(), EMAN::DotCmp::cmp(), EMAN::CccCmp::cmp(), EMAN::EMData::cog(), EMAN::EMAN1Ctf::compute_1d(), EMAN::EMData::compute_missingwedge(), EMAN::Util::constrained_helix_exhaustive(), EMAN::SetSFProcessor::create_radial_func(), EMAN::MatchSFProcessor::create_radial_func(), EMAN::DoGFourierProcessor::create_radial_func(), EMAN::Util::curhelixshiftali(), dcstep_(), dist_r(), EMAN::Point3::distanceFromOrigin(), EMAN::Point3::distanceTo(), dnrm2_(), EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), EMAN::PCA::dopca_lan(), EMAN::PCA::dopca_ooc(), doRotation(), dpofa_(), drwarc_(), EMAN::Processor::EMFourierFilterFunc(), EMAN::EMData::extract_plane_rect_fast(), EMAN::EMData::FH2F(), EMAN::nnSSNR_ctfReconstructor::finish(), EMAN::nn4_ctf_rectReconstructor::finish(), EMAN::nn4_ctfwReconstructor::finish(), EMAN::nn4_ctfReconstructor::finish(), EMAN::nnSSNR_Reconstructor::finish(), EMAN::IterationAverager::finish(), EMAN::ImageAverager::finish(), EMAN::PointArray::fit_helix(), EMAN::EMData::Four_shuf_ds_cen_us(), EMAN::EMData::FourInterpol(), GCVmin_Tik(), EMAN::SaffOrientationGenerator::gen_orientations(), ctf_store_new::get_ctf(), ctf_store::get_ctf(), EMAN::EMData::get_fft_amplitude2D(), EMAN::Randnum::get_gauss_rand(), EMAN::SaffOrientationGenerator::get_orientations_tally(), EMAN::Transform::get_rotation(), EMAN::Util::get_stats(), EMAN::Util::get_stats_cstyle(), EMAN::EMUtil::getRenderMinMax(), EMAN::Util::group_proj_by_phitheta(), EMAN::Util::helixshiftali(), EMAN::Util::hypot3(), EMAN::Util::FakeKaiserBessel::i0win(), EMAN::Util::KaiserBessel::i0win(), EMAN::Util::infomask(), EMAN::FourierInserter3DMode7::insert_pixel(), EMAN::EMData::insert_rect_slice(), EMAN::EMData::insert_rect_slice_ctf(), EMAN::EMData::insert_rect_slice_ctf_applied(), EMAN::nn4_rectReconstructor::insert_slice(), inside_(), EMAN::GaussFFTProjector::interp_ft_3d(), intrsc_(), EMAN::EMAN2Ctf::lambda(), LBD_Cart(), EMAN::Vector4::length(), EMAN::Vector3::length(), EMAN::ScreenVector::length(), EMAN::Vec2< Type >::length(), EMAN::Vec3< int >::length(), EMAN::Vec4< Type >::length(), lnsrlb_(), EMAN::Util::local_inner_product(), main(), EMAN::PointArray::mask_asymmetric_unit(), EMAN::EMData::mult_radial(), EMAN::Util::multi_align_error_dfunc(), EMAN::Util::multi_align_error_func2(), norm(), EMAN::Vector3::normalize(), EMAN::Quaternion::normalize(), EMAN::Util::Normalize_ring(), EMAN::ReconstructorVolumeData::normalize_threed(), normas(), normass(), EMAN::EMData::onelinenn_ctfw(), EMAN::PointArray::pdb2mrc_by_summation(), EMAN::FourierReconstructor::preprocess_slice(), EMAN::NewFourierProcessor::preprocessandconvertpars(), EMAN::ConvolutionKernelProcessor::process(), EMAN::SubtractOptProcessor::process(), EMAN::MakeRadiusProcessor::process_dist_pixel(), EMAN::MaskGaussProcessor::process_dist_pixel(), EMAN::MaskSoftProcessor::process_dist_pixel(), EMAN::NewLowpassGaussProcessor::process_inplace(), EMAN::RotateInFSProcessor::process_inplace(), EMAN::RadialProcessor::process_inplace(), EMAN::TestImageSinewaveCircular::process_inplace(), EMAN::TestImagePureGaussian::process_inplace(), EMAN::TestImageGaussian::process_inplace(), EMAN::TestImageFourierNoiseProfile::process_inplace(), EMAN::CTFSNRWeightProcessor::process_inplace(), EMAN::TestImageFourierNoiseGaussian::process_inplace(), EMAN::SmartMaskProcessor::process_inplace(), EMAN::AddRandomNoiseProcessor::process_inplace(), EMAN::BeamstopProcessor::process_inplace(), EMAN::PaintProcessor::process_inplace(), EMAN::BoxSigmaProcessor::process_pixel(), EMAN::MaskGaussNonuniformProcessor::process_pixel(), EMAN::ValueSqrtProcessor::process_pixel(), projct_(), EMAN::PointArray::projection_by_summation(), EMAN::Quaternion::Quaternion(), recons3d_CGLS_mpi_Cart(), recons3d_HyBR_mpi_Cart(), recons3d_sirt_mpi(), recons3d_sirt_mpi_Cart(), refalin3d_perturbquat(), EMAN::EMData::replace_amplitudes(), EMAN::PointArray::replace_by_summation(), EMAN::EMData::rotavg(), EMAN::EMData::rotavg_i(), sbdsqr_(), EMAN::EMData::scale_factors(), scoord_(), EMAN::PointArray::set_from_density_map(), sgesvd_(), EMAN::Util::FakeKaiserBessel::sinhwin(), EMAN::Util::KaiserBessel::sinhwin(), slae2_(), slaed2_(), slaed3_(), slaed4_(), slaed5_(), slaed6_(), slaed8_(), slaed9_(), slaeda_(), slaev2_(), slange_(), slanst_(), slansy_(), slapy2_(), slartg_(), slas2_(), slasq1_(), slasq2_(), slasq3_(), slasq4_(), slasv2_(), snrm2_(), sstedc_(), ssteqr_(), ssterf_(), sstevd_(), ssyev_(), Steepda(), Steepda_G(), EMAN::EMAN2Ctf::stos2(), EMAN::Util::tf(), trplot_(), EMAN::Util::TwoDTestFunc(), EMAN::EMData::unwrap_largerR(), EMAN::KMeansAnalyzer::update_centers(), EMAN::EMData::update_stat(), EMAN::MrcIO::update_stats(), Utilit1(), vrplot_(), EMAN::Util::windowdot(), EMAN::Util::WTM(), EMAN::RT3DSphereAligner::xform_align_nbest(), EMAN::RT3DGridAligner::xform_align_nbest(), and EMAN::EMAN2Ctf::zero().

void sub ( const EMData &  image)

subtract a same-size image from this image pixel by pixel.

Parameters:
imageThe image subtracted from 'this' image.
Exceptions:
ImageFormatExceptionIf the 2 images are not same size.
void sub ( float  f)

subtract a float number to each pixel value of the image.

Parameters:
fThe float number subtracted from 'this' image.

Referenced by EMAN::WienerFourierReconstructor::do_insert_slice_work(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

void subsquare ( const EMData &  image)

subtract the squared value of each pixel from a same-size image to this image.

Parameters:
imageThe image whose square is subtracted from 'this' image.
Exceptions:
ImageFormatExceptionIf the 2 images are not same size.
void to_one ( )

set all the pixel values = 1.

void to_value ( const float &  value)

set all the pixel values to a value.

void to_zero ( )

Set all the pixel value = 0.