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
 Make a copy of this image including both data and header.
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 (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 (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:
InvalidCallException this function call require a complex image in real/imaginary format.

void add ( const EMData &  image  ) 

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

Parameters:
image The image added to 'this' image.
Exceptions:
ImageFormatException If the 2 images are not same size.

void add ( float  f,
int  keepzero = 0 
)

add a number to each pixel value of the image.

Image may be real or complex.

Parameters:
f The number added to 'this' image.
keepzero If set will not modify pixels that are exactly zero

Referenced by EMAN::KMeansAnalyzer::update_centers().

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:
x x coordinate
y y coordinate
z z coordinate
val complex<float> value to set
Returns:
The complex pixel at x,y

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:
x x coordinate
y y coordinate
z z coordinate
val complex<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, and rdata.

00337                                                                                                        {
00338 //if (x>=nx/2 || y>ny/2 || z>nz/2 || x<=-nx/2 || y<-ny/2 || z<-nz/2) return nxyz;
00339 
00340 size_t idx;
00341 if (x<0) {
00342         idx=-x*2+(y<=0?-y:ny-y)*(size_t)nx+(z<=0?-z:nz-z)*(size_t)nxy;
00343         rdata[idx]+=(float)val.real();
00344         rdata[idx+1]-=(float)val.imag();
00345         return idx;
00346 }
00347 
00348 idx=x*2+(y<0?ny+y:y)*(size_t)nx+(z<0?nz+z:z)*(size_t)nxy;
00349 rdata[idx]+=(float)val.real();
00350 rdata[idx+1]+=(float)val.imag();
00351 
00352 return idx;
00353 }

void addsquare ( const EMData &  image  ) 

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

Parameters:
image The image whose square is added to 'this' image.
Exceptions:
ImageFormatException If the 2 images are not same size.

Referenced by EMAN::KMeansAnalyzer::update_centers().

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:
InvalidCallException if this image is a real image or is in real/imaginary format

std::complex<float>& cmplx ( const int  ix  ) 

Definition at line 693 of file emdata_core.h.

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

00693                                        {
00694         ptrdiff_t pos = 2*(ix-xoff);
00695 #ifdef BOUNDS_CHECKING
00696         if (pos < 0 || pos >= (size_t)nx*ny*nz)
00697                 throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
00698 #endif // BOUNDS_CHECKING
00699         float* begin = get_data() + pos;
00700         return *(reinterpret_cast<std::complex<float>* >(begin));
00701 }

std::complex<float>& cmplx ( const int  ix,
const int  iy 
)

Definition at line 682 of file emdata_core.h.

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

00682                                                      {
00683         ptrdiff_t pos = 2*(ix-xoff)+(iy-yoff)*nx;
00684 #ifdef BOUNDS_CHECKING
00685         if (pos < 0 || pos >= (size_t)nx*ny*nz)
00686                 throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
00687 #endif // BOUNDS_CHECKING
00688         float* begin = get_data() + pos;
00689         return *(reinterpret_cast<std::complex<float>* >(begin));
00690 }

std::complex<float>& cmplx ( const int  ix,
const int  iy,
const int  iz 
)

Return reference to complex elements.

Definition at line 671 of file emdata_core.h.

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

00671                                                                    {
00672         ptrdiff_t pos = 2*(ix-xoff)+((iy-yoff)+(iz-zoff)*ny)*(size_t)nx;
00673 #ifdef BOUNDS_CHECKING
00674         if (pos < 0 || pos >= (size_t)nx*ny*nz)
00675                 throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
00676 #endif // BOUNDS_CHECKING
00677         float* begin = get_data() + pos;
00678         return *(reinterpret_cast<std::complex<float>* >(begin));
00679 }

EMData* copy (  )  const

Make a copy of this image including both data and header.

Returns:
A copy of this image including both data and header.

Referenced by EMAN::CtfCAutoAverager::add_image(), EMAN::CtfCWautoAverager::add_image(), EMAN::KMeansAnalyzer::analyze(), EMAN::Transform::detect_problem_keys(), EMAN::Dict::Dict(), EMAN::EMData::get_attr(), get_data_as_vector(), main(), EMAN::FloatPoint::operator=(), EMAN::Dict::operator=(), EMAN::RotateInFSProcessor::process(), EMAN::RotateInFSProcessor::process_inplace(), EMAN::MedianShrinkProcessor::process_inplace(), EMAN::WatershedProcessor::process_inplace(), EMAN::MrcIO::transpose(), EMAN::SpiderIO::write_single_header(), EMAN::RT3DSymmetryAligner::xform_align_nbest(), EMAN::RT3DSphereAligner::xform_align_nbest(), and EMAN::RT3DGridAligner::xform_align_nbest().

EMData* copy_head (  )  const

Make an image with a copy of the current image's header.

Returns:
An image with a copy of the current image's header.

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

void div ( const EMData &  image  ) 

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

Parameters:
image The image 'this' image divided by.
Exceptions:
ImageFormatException If the 2 images are not same size.

void div ( float  f  ) 

make each pixel value divided by a float number.

Parameters:
f The float number 'this' image divided by.

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

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:
with The image to do dot product with.
Exceptions:
NullPointerException if with is a NULL image.
Returns:
The dot product result.

Referenced by main().

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 (  ) 

Definition at line 661 of file emdata_core.h.

00661                                 {
00662         vector<int> offsets;
00663         offsets.push_back(xoff);
00664         offsets.push_back(yoff);
00665         offsets.push_back(zoff);
00666         return offsets;
00667 }

EMData* get_col ( int  col_index  )  const

Get one column of a 2D images.

Parameters:
col_index Index of the column.
Exceptions:
ImageDimensionException If 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 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:
x x coordinate
y y coordinate
z z coordinate
Returns:
The complex pixel at x,y

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:
x x coordinate
y y 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 ( 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:
x x coordinate
y y coordinate
z z coordinate
Returns:
The complex pixel at x,y

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, and ny.

00285                                                                                    {
00286 //      if (abs(x)>=nx/2 || abs(y)>ny/2 || abs(z)>nz/2) return nxyz;
00287         if (x<0) {
00288                 return (size_t)x*-2+(y<=0?-y:ny-y)*(size_t)nx+(z<=0?-z:nz-z)*(size_t)nxy;
00289         }
00290         return x*2+(y<0?ny+y:y)*(size_t)nx+(z<0?nz+z:z)*(size_t)nxy;
00291 }

EMData* get_row ( int  row_index  )  const

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

Parameters:
row_index Index of the row.
Exceptions:
ImageDimensionException If this image is 3D.
Returns:
A 1D image with the row data.

Referenced by recons3d_HyBR_mpi_Cart().

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:
i 1D data array index.
Returns:
The pixel density value

Definition at line 237 of file emdata_core.h.

References get_data().

00238 {
00239         return get_data()[i];
00240 }

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:
x The x coordinate.
y The 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.

00225 {
00226         return get_data()[x + y * nx];
00227 }

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:
x The x coordinate.
y The y coordinate.
z The 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::Util::constrained_helix(), EMAN::Util::constrained_helix_test(), EMAN::RotateInFSProcessor::process_inplace(), and EMAN::Util::svdcmp().

00205 {
00206         return get_data()[(size_t)x + (size_t)y * (size_t)nx + (size_t)z * (size_t)nxy];
00207 }

float get_value_at_index ( int  i  )  [inline]

Get the pixel density value at index i.

Parameters:
a The index.

Definition at line 212 of file emdata_core.h.

References rdata.

00213 {
00214         return *(rdata + i);
00215 }

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:
x The x coordinate.
Returns:
The pixel density value at circulant coordinates (x).

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:
x The x coordinate.
y The y coordinate.
Returns:
The pixel density value at circulant coordinates (x,y).

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:
x The x coordinate.
y The y coordinate.
z The z coordinate.
Returns:
The pixel density value at circulant coordinates (x,y,z).

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:
InvalidCallException if this image is a real image
InvalidCallException if this image is a complex image in amplitude/phase format

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

EMData* log (  )  const

return natural logarithm image for a image

Returns:
a image which is the natural logarithm of this image
Exceptions:
InvalidValueException pixel value must be >= 0
ImageFormatException real image only

Referenced by EMAN::LowpassAutoBProcessor::create_radial_func(), EMAN::Util::Crosrng_e(), EMAN::Util::Crosrng_ew(), EMAN::Util::Crosrng_ms(), EMAN::Util::Crosrng_ms_delta(), EMAN::Util::Crosrng_msg(), EMAN::Util::Crosrng_msg_m(), EMAN::Util::Crosrng_msg_s(), EMAN::Util::Crosrng_msg_vec(), EMAN::Util::Crosrng_ns(), EMAN::Util::Crosrng_psi(), EMAN::Util::Crosrng_sm_psi(), EMAN::Util::Frngs(), EMAN::Util::Frngs_inv(), EMAN::Randnum::get_gauss_rand(), EMAN::EMData::log(), EMAN::PointArray::pdb2mrc_by_summation(), EMAN::NewLowpassGaussProcessor::process_inplace(), EMAN::PointArray::projection_by_summation(), EMAN::Util::pw_extract(), EMAN::PointArray::replace_by_summation(), EMAN::PointArray::set_from_density_map(), slaed0_(), slaed6_(), slartg_(), and sstedc_().

EMData* log10 (  )  const

return base 10 logarithm image for a image

Returns:
a image which is the base 10 logarithm of this image
Exceptions:
InvalidValueException pixel value must be >= 0
ImageFormatException real image only

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

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:
image The image multiplied to 'this' image.
prevent_complex_multiplication if the image is complex, this flag will override complex multiplication and just multiply each pixel by the other
Exceptions:
ImageFormatException If the 2 images are not same size.

void mult ( float  f  ) 

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

Parameters:
f The float multiplied to 'this' image.

void mult ( int  n  ) 

multiply an integer number to each pixel value of the image.

Parameters:
n The integer multiplied to 'this' image.

Definition at line 101 of file emdata_core.h.

Referenced by EMAN::nnSSNR_ctfReconstructor::insert_slice(), EMAN::nn4_ctf_rectReconstructor::insert_slice(), EMAN::nn4_ctfReconstructor::insert_slice(), EMAN::nnSSNR_Reconstructor::insert_slice(), EMAN::nn4_rectReconstructor::insert_slice(), and EMAN::nn4Reconstructor::insert_slice().

00102 {
00103         mult((float)n);
00104 }

void mult_complex_efficient ( const EMData &  em,
const int  radius 
)

EMData& operator *= ( const EMData &  em  ) 

EMData& operator *= ( float  n  ) 

float& operator() ( const size_t  ix  )  const [inline]

Definition at line 639 of file emdata_core.h.

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

00639                                                 {
00640         ptrdiff_t pos = ix - xoff;
00641 #ifdef BOUNDS_CHECKING
00642         if (pos < 0 || pos >= (size_t)nx*ny*nz)
00643                 throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
00644 #endif // BOUNDS_CHECKING
00645         return *(get_data() + pos);
00646 }

float& operator() ( const int  ix,
const int  iy 
) const [inline]

Definition at line 627 of file emdata_core.h.

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

00627                                                            {
00628         ptrdiff_t pos = (ix - xoff) + (iy-yoff)*nx;
00629 #ifdef BOUNDS_CHECKING
00630         if (pos < 0 || pos >= (size_t)nx*ny*nz)
00631         {
00632                 throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
00633         }
00634 #endif // BOUNDS_CHECKING
00635         return *(get_data() + pos);
00636 }

float& operator() ( const int  ix,
const int  iy,
const int  iz 
) const [inline]

Overload operator() for array indexing.

Definition at line 617 of file emdata_core.h.

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

00617                                                                          {
00618         ptrdiff_t pos = (size_t)(ix-xoff) + ((iy-yoff) + (size_t)(iz-zoff)*ny)*nx;
00619 #ifdef BOUNDS_CHECKING
00620         if (pos < 0 || pos >= (size_t)nx*ny*nz) {
00621                 throw OutofRangeException(0, (size_t)nx*ny*nz-1, pos, "EMData");
00622         }
00623 #endif // BOUNDS_CHECKING
00624         return *(get_data() + pos);
00625 }

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  ) 

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:
InvalidCallException if 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:
n the power of this image
Returns:
a image which is the nth power of this image
Exceptions:
InvalidValueException n 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:
img give an artificial imaginary part
Returns:
a complex image which is generated from a real image
Exceptions:
InvalidCallException this function can not be called by complex image

void set_array_offsets ( vector< int >  offsets  ) 

Definition at line 656 of file emdata_core.h.

References set_array_offsets().

00656                                             {
00657         set_array_offsets(offsets[0],offsets[1],offsets[2]);
00658 }

void set_array_offsets ( const int  xoff_ = 0,
const int  yoff_ = 0,
const int  zoff_ = 0 
)

Set the array offsets.

Definition at line 650 of file emdata_core.h.

Referenced by set_array_offsets().

00651                                                   {
00652         xoff=xoff_; yoff=yoff_; zoff=zoff_;
00653 }

void set_col ( const EMData *  data,
int  col_index 
)

Set one column of a 2D image.

Parameters:
data The column image data.
col_index Index of the column.
Exceptions:
ImageDimensionException If this image is not 2D.

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:
x x coordinate
y y coordinate
z z coordinate
val complex<float> value to set
Returns:
The complex pixel at x,y

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:
x x coordinate
y y coordinate
val complex<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:
data The row image data.
row_index Index of the row.
Exceptions:
ImageDimensionException If this image is 3D.

void set_value_at ( int  x,
float  v 
) [inline]

Set the pixel density value at coordinate (x).

1D image only.

Parameters:
x The x coordinate.
v The pixel density value at coordinate (x).
Exceptions:
OutofRangeException wehn index out of image data's range.

Definition at line 564 of file emdata_core.h.

References get_data(), nx, and OutofRangeException.

00565 {
00566         if( x>=nx || x<0 )
00567         {
00568                 throw OutofRangeException(0, nx-1, x, "x dimension index");
00569         }
00570         else
00571         {
00572                 get_data()[x] = v;
00573                 flags |= EMDATA_NEEDUPD;
00574                 changecount++;
00575         }
00576 }

void set_value_at ( int  x,
int  y,
float  v 
) [inline]

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

2D image only.

Parameters:
x The x coordinate.
y The y coordinate.
v The pixel density value at coordinates (x,y).
Exceptions:
OutofRangeException wehn index out of image data's range.

Definition at line 523 of file emdata_core.h.

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

00524 {
00525         if( x>=nx || x<0 )
00526         {
00527                 throw OutofRangeException(0, nx-1, x, "x dimension index");
00528         }
00529         else if( y>=ny || y<0 )
00530         {
00531                 throw OutofRangeException(0, ny-1, y, "y dimension index");
00532         }
00533         else
00534         {
00535                 get_data()[x + y * nx] = v;
00536                 flags |= EMDATA_NEEDUPD;
00537                 changecount++;
00538         }
00539 }

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:
x The x coordinate.
y The y coordinate.
z The z coordinate.
v The pixel density value at coordinates (x,y,z).
Exceptions:
OutofRangeException wehn index out of image data's range.

Definition at line 465 of file emdata_core.h.

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

Referenced by EMAN::RotateInFSProcessor::process_inplace().

00466 {
00467         if( x>=nx || x<0 )
00468         {
00469                 throw OutofRangeException(0, nx-1, x, "x dimension index");
00470         }
00471         else if( y>=ny || y<0 )
00472         {
00473                 throw OutofRangeException(0, ny-1, y, "y dimension index");
00474         }
00475         else if( z>=nz || z<0 )
00476         {
00477                 throw OutofRangeException(0, nz-1, z, "z dimension index");
00478         }
00479         else
00480         {
00481                 get_data()[(size_t)x + (size_t)y * (size_t)nx + (size_t)z * (size_t)nxy] = v;
00482                 flags |= EMDATA_NEEDUPD;
00483                 changecount++;
00484         }
00485 }

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

Set the pixel density value at coordinate (x).

1D image only.

Parameters:
x The x coordinate.
v The pixel density value at coordinate (x).

Definition at line 584 of file emdata_core.h.

References get_data().

00585 {
00586         get_data()[x] = v;
00587         flags |= EMDATA_NEEDUPD;
00588         changecount++;
00589 }

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:
x The x coordinate.
y The y coordinate.
v The pixel density value at coordinates (x,y).

Definition at line 549 of file emdata_core.h.

References get_data(), and nx.

00550 {
00551         get_data()[x + y * nx] = v;
00552         flags |= EMDATA_NEEDUPD;
00553         changecount++;
00554 }

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:
x The x coordinate.
y The y coordinate.
z The z coordinate.
v The pixel density value at coordinates (x,y,z).

Definition at line 497 of file emdata_core.h.

References get_data(), and nx.

00498 {
00499         get_data()[(size_t)x + (size_t)y * (size_t)nx + (size_t)z * (size_t)nxy] = v;
00500         flags |= EMDATA_NEEDUPD;
00501         changecount++;
00502 }

void set_value_at_index ( int  i,
float  v 
) [inline]

Set the pixel density value at index.

Parameters:
i The index.
v The value.

Definition at line 510 of file emdata_core.h.

References rdata.

00511 {
00512         *(rdata + i) = v;
00513 }

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:
i 1D data array index.
Returns:
The pixel density value

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:
x The x coordinate.
y The y coordinate.
Returns:
The pixel density value at coordinates (x,y).

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:
x The x coordinate.
y The y coordinate.
z The z coordinate.
Returns:
The pixel density value at coordinates (x,y,z).

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:
x The x coordinate.
y The y coordinate.
z The z coordinate.
Returns:
The pixel density value at coordinates (x,y,z).

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:
x The x coordinate.
y The y coordinate.
Returns:
The pixel density value at coordinates (x,y).

EMData* sqrt (  )  const

return square root of current image

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

Referenced by EMAN::Quaternion::abs(), EMAN::EMData::absi(), EMAN::newfile_store::add_image(), EMAN::FRM2DAligner::align(), EMAN::Refine3DAlignerGrid::align(), angle_(), EMAN::EMData::apply_radial_func(), areas_(), bmv_(), EMAN::Util::FakeKaiserBessel::build_I0table(), EMAN::Util::KaiserBessel::build_I0table(), EMAN::EMAN2Ctf::calc_amp1(), EMAN::EMAN1Ctf::calc_amp1(), EMAN::EMAN2Ctf::calc_amplitude(), EMAN::EMAN1Ctf::calc_amplitude(), EMAN::EMData::calc_ccfx(), EMAN::XYData::calc_correlation(), EMAN::EMData::calc_dist(), EMAN::EMData::calc_fourier_shell_correlation(), EMAN::EMAN2Ctf::calc_lambda(), EMAN::EMAN1Ctf::calc_lambda(), EMAN::MaskEdgeMeanProcessor::calc_locals(), EMAN::EMData::calc_mutual_correlation(), EMAN::EMAN1Ctf::calc_noise(), EMAN::NormalizeMaskProcessor::calc_sigma(), EMAN::NormalizeUnitProcessor::calc_sigma(), EMAN::EMData::calc_sigma_diff(), 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::EMData::common_lines(), EMAN::EMData::common_lines_real(), EMAN::EMAN1Ctf::compute_1d(), EMAN::EMData::compute_missingwedge(), EMAN::Util::constrained_helix(), EMAN::Util::constrained_helix_test(), EMAN::SetSFProcessor::create_radial_func(), EMAN::MatchSFProcessor::create_radial_func(), EMAN::DoGFourierProcessor::create_radial_func(), 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::FH2F(), EMAN::nnSSNR_ctfReconstructor::finish(), EMAN::nn4_ctf_rectReconstructor::finish(), EMAN::nn4_ctfReconstructor::finish(), EMAN::nnSSNR_Reconstructor::finish(), EMAN::IterationAverager::finish(), EMAN::ImageAverager::finish(), 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::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_(), LBD_Cart(), EMAN::Vector4::length(), EMAN::Vector3::length(), EMAN::ScreenVector::length(), EMAN::Vec2< Type >::length(), EMAN::Vec3< Type >::length(), EMAN::Vec4< Type >::length(), EMAN::EMData::little_big_dot(), lnsrlb_(), main(), EMAN::PointArray::mask_asymmetric_unit(), EMAN::EMData::max_3D_pixel_error(), 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::PointArray::pdb2mrc_by_summation(), EMAN::FourierReconstructor::preprocess_slice(), EMAN::NewFourierProcessor::preprocessandconvertpars(), EMAN::ConvolutionKernelProcessor::process(), EMAN::MakeRadiusProcessor::process_dist_pixel(), EMAN::MaskGaussProcessor::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::PointArray::replace_by_summation(), EMAN::EMData::rotavg(), EMAN::EMData::rotavg_i(), sbdsqr_(), 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_(), EMAN::EMData::sqrt(), sstedc_(), ssteqr_(), ssterf_(), sstevd_(), ssyev_(), Steepda(), Steepda_G(), EMAN::Util::tf(), trplot_(), EMAN::Util::TwoDTestFunc(), EMAN::EMData::unwrap_largerR(), EMAN::KMeansAnalyzer::update_centers(), EMAN::MrcIO::update_stat(), EMAN::EMData::update_stat(), Utilit1(), vrplot_(), EMAN::Util::WTM(), EMAN::RT3DSphereAligner::xform_align_nbest(), and EMAN::RT3DGridAligner::xform_align_nbest().

void sub ( const EMData &  image  ) 

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

Parameters:
image The image subtracted from 'this' image.
Exceptions:
ImageFormatException If the 2 images are not same size.

void sub ( float  f  ) 

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

Parameters:
f The 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:
image The image whose square is subtracted from 'this' image.
Exceptions:
ImageFormatException If 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.

Referenced by EMAN::KMeansAnalyzer::update_centers().


Generated on Tue Jun 11 12:40:50 2013 for EMAN2 by  doxygen 1.4.7