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 (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 (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.
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
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 int 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

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 330 of file emdata_core.h.

References nx, ny, and rdata.

00330                                                                                                        {
00331 //if (x>=nx/2 || y>ny/2 || z>nz/2 || x<=-nx/2 || y<-ny/2 || z<-nz/2) return nxyz;
00332 
00333 size_t idx;
00334 if (x<0) {
00335         idx=-x*2+(y<=0?-y:ny-y)*(size_t)nx+(z<=0?-z:nz-z)*(size_t)nxy;
00336         rdata[idx]+=(float)val.real();
00337         rdata[idx+1]-=(float)val.imag();
00338         return idx;
00339 }
00340 
00341 idx=x*2+(y<0?ny+y:y)*(size_t)nx+(z<0?nz+z:z)*(size_t)nxy;
00342 rdata[idx]+=(float)val.real();
00343 rdata[idx+1]+=(float)val.imag();
00344 
00345 return idx;
00346 }

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.

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 669 of file emdata_core.h.

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

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

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

Definition at line 658 of file emdata_core.h.

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

00658                                                      {
00659         ptrdiff_t pos = 2*(ix-xoff)+(iy-yoff)*nx;
00660 #ifdef BOUNDS_CHECKING
00661         if (pos < 0 || pos >= nx*ny*nz)
00662                 throw OutofRangeException(0, nx*ny*nz-1, pos, "EMData");
00663 #endif // BOUNDS_CHECKING
00664         float* begin = get_data() + pos;
00665         return *(reinterpret_cast<std::complex<float>* >(begin));
00666 }

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

Return reference to complex elements.

Definition at line 647 of file emdata_core.h.

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

00647                                                                    {
00648         ptrdiff_t pos = 2*(ix-xoff)+((iy-yoff)+(iz-zoff)*ny)*nx;
00649 #ifdef BOUNDS_CHECKING
00650         if (pos < 0 || pos >= nx*ny*nz)
00651                 throw OutofRangeException(0, nx*ny*nz-1, pos, "EMData");
00652 #endif // BOUNDS_CHECKING
00653         float* begin = get_data() + pos;
00654         return *(reinterpret_cast<std::complex<float>* >(begin));
00655 }

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::CtfCWautoAverager::add_image(), EMAN::KMeansAnalyzer::analyze(), EMAN::Transform::detect_problem_keys(), EMAN::Dict::Dict(), get_data_as_vector(), main(), EMAN::FloatPoint::operator=(), EMAN::Dict::operator=(), EMAN::MedianShrinkProcessor::process_inplace(), EMAN::WatershedProcessor::process_inplace(), EMAN::KMeansAnalyzer::reseed(), EMAN::SpiderIO::write_single_header(), 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().

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

void free_memory (  ) 

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

vector<int> get_array_offsets (  ) 

Definition at line 637 of file emdata_core.h.

00637                                 {
00638         vector<int> offsets;
00639         offsets.push_back(xoff);
00640         offsets.push_back(yoff);
00641         offsets.push_back(zoff);
00642         return offsets;
00643 }

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 278 of file emdata_core.h.

References nx, and ny.

00278                                                                                    {
00279 //      if (abs(x)>=nx/2 || abs(y)>ny/2 || abs(z)>nz/2) return nxyz;
00280         if (x<0) {
00281                 return (size_t)x*-2+(y<=0?-y:ny-y)*(size_t)nx+(z<=0?-z:nz-z)*(size_t)nxy;
00282         }
00283         return x*2+(y<0?ny+y:y)*(size_t)nx+(z<0?nz+z:z)*(size_t)nxy;
00284 }

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 230 of file emdata_core.h.

References get_data().

00231 {
00232         return get_data()[i];
00233 }

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

Definition at line 217 of file emdata_core.h.

References get_data(), and nx.

00218 {
00219         return get_data()[x + y * nx];
00220 }

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 cooridinate.
y The y cooridinate.
z The z cooridinate.
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::svdcmp().

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

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 cooridinate.
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 cooridinate.
y The y cooridinate.
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 cooridinate.
y The y cooridinate.
z The z cooridinate.
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_0_180(), 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::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(), and EMAN::LogProcessor::process_pixel().

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_ctfReconstructor::insert_slice(), EMAN::nnSSNR_Reconstructor::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 int  ix  )  const [inline]

Definition at line 615 of file emdata_core.h.

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

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

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

Definition at line 603 of file emdata_core.h.

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

00603                                                            {
00604         ptrdiff_t pos = (ix - xoff) + (iy-yoff)*nx;
00605 #ifdef BOUNDS_CHECKING
00606         if (pos < 0 || pos >= nx*ny*nz)
00607         {
00608                 throw OutofRangeException(0, nx*ny*nz-1, pos, "EMData");
00609         }
00610 #endif // BOUNDS_CHECKING
00611         return *(get_data() + pos);
00612 }

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

Overload operator() for array indexing.

Definition at line 593 of file emdata_core.h.

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

00593                                                                          {
00594         ptrdiff_t pos = (ix-xoff) + ((iy-yoff) + (iz-zoff)*ny)*nx;
00595 #ifdef BOUNDS_CHECKING
00596         if (pos < 0 || pos >= nx*ny*nz) {
00597                 throw OutofRangeException(0, nx*ny*nz-1, pos, "EMData");
00598         }
00599 #endif // BOUNDS_CHECKING
00600         return *(get_data() + pos);
00601 }

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::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 632 of file emdata_core.h.

References set_array_offsets().

00632                                             {
00633         set_array_offsets(offsets[0],offsets[1],offsets[2]);
00634 }

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

Set the array offsets.

Definition at line 626 of file emdata_core.h.

Referenced by set_array_offsets().

00627                                                   {
00628         xoff=xoff_; yoff=yoff_; zoff=zoff_;
00629 }

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

Definition at line 547 of file emdata_core.h.

References get_data(), nx, and OutofRangeException.

00548 {
00549         if( x>=nx || x<0 )
00550         {
00551                 throw OutofRangeException(0, nx-1, x, "x dimension index");
00552         }
00553         else
00554         {
00555                 get_data()[x] = v;
00556                 flags |= EMDATA_NEEDUPD;
00557                 changecount++;
00558         }
00559 }

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

Definition at line 506 of file emdata_core.h.

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

00507 {
00508         if( x>=nx || x<0 )
00509         {
00510                 throw OutofRangeException(0, nx-1, x, "x dimension index");
00511         }
00512         else if( y>=ny || y<0 )
00513         {
00514                 throw OutofRangeException(0, ny-1, y, "y dimension index");
00515         }
00516         else
00517         {
00518                 get_data()[x + y * nx] = v;
00519                 flags |= EMDATA_NEEDUPD;
00520                 changecount++;
00521         }
00522 }

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

Definition at line 458 of file emdata_core.h.

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

00459 {
00460         if( x>=nx || x<0 )
00461         {
00462                 throw OutofRangeException(0, nx-1, x, "x dimension index");
00463         }
00464         else if( y>=ny || y<0 )
00465         {
00466                 throw OutofRangeException(0, ny-1, y, "y dimension index");
00467         }
00468         else if( z>=nz || z<0 )
00469         {
00470                 throw OutofRangeException(0, nz-1, z, "z dimension index");
00471         }
00472         else
00473         {
00474                 get_data()[x + y * nx + z * nxy] = v;
00475                 flags |= EMDATA_NEEDUPD;
00476                 changecount++;
00477         }
00478 }

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 cooridinate.
v The pixel density value at coordinate (x).

Definition at line 567 of file emdata_core.h.

References get_data().

00568 {
00569         get_data()[x] = v;
00570         flags |= EMDATA_NEEDUPD;
00571         changecount++;
00572 }

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

Definition at line 532 of file emdata_core.h.

References get_data(), and nx.

00533 {
00534         get_data()[x + y * nx] = v;
00535         flags |= EMDATA_NEEDUPD;
00536         changecount++;
00537 }

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

Definition at line 490 of file emdata_core.h.

References get_data(), and nx.

00491 {
00492         get_data()[x + y * nx + z * nxy] = v;
00493         flags |= EMDATA_NEEDUPD;
00494         changecount++;
00495 }

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 cooridinate.
y The y cooridinate.
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 cooridinate.
y The y cooridinate.
z The z cooridinate.
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 cooridinate.
y The y cooridinate.
z The z cooridinate.
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 cooridinate.
y The y cooridinate.
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::CtfAverager::add_image(), 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::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::DotCmp::cmp(), EMAN::CccCmp::cmp(), EMAN::EMData::cog(), EMAN::EMData::common_lines(), EMAN::EMData::common_lines_real(), EMAN::EMAN1Ctf::compute_1d(), EMAN::SetSFProcessor::create_radial_func(), EMAN::MatchSFProcessor::create_radial_func(), dcstep_(), dist_r(), EMAN::Point3::distanceFromOrigin(), EMAN::Point3::distanceTo(), dnrm2_(), 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_ctfReconstructor::finish(), EMAN::nnSSNR_Reconstructor::finish(), EMAN::IterationAverager::finish(), EMAN::ImageAverager::finish(), EMAN::EMData::Four_shuf_ds_cen_us(), EMAN::EMData::FourInterpol(), GCVmin_Tik(), EMAN::SaffOrientationGenerator::gen_orientations(), ctf_store::get_ctf(), EMAN::EMData::get_fft_amplitude2D(), EMAN::Randnum::get_gauss_rand(), EMAN::SaffOrientationGenerator::get_orientations_tally(), EMAN::Transform3D::get_rotation(), EMAN::Transform::get_rotation(), EMAN::Transform3D::get_scale(), EMAN::Util::get_stats(), EMAN::Util::get_stats_cstyle(), EMAN::EMUtil::getRenderMinMax(), EMAN::Util::FakeKaiserBessel::i0win(), EMAN::Util::KaiserBessel::i0win(), EMAN::Util::infomask(), EMAN::FourierInserter3DMode7::insert_pixel(), EMAN::WienerFourierReconstructor::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::EMData::little_big_dot(), lnsrlb_(), main(), EMAN::PointArray::mask_asymmetric_unit(), EMAN::EMData::max_3D_pixel_error(), EMAN::EMData::mult_radial(), 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::MakeRadiusProcessor::process_dist_pixel(), EMAN::MaskGaussProcessor::process_dist_pixel(), 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(), EMAN::EMData::replace_amplitudes(), 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_(), and EMAN::Util::WTM().

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::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 May 25 17:13:58 2010 for EMAN2 by  doxygen 1.4.7