EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::TestImageGaussian Class Reference

Replace a source image as a Gaussian Blob. More...

#include <processor.h>

Inheritance diagram for EMAN::TestImageGaussian:
Inheritance graph
[legend]
Collaboration diagram for EMAN::TestImageGaussian:
Collaboration graph
[legend]

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::TestImageProcessor
static string get_group_desc ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Static Public Attributes

static const string NAME = "testimage.gaussian"
 

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Member Functions inherited from EMAN::TestImageProcessor
void preprocess (EMData *image)
 
- Protected Attributes inherited from EMAN::TestImageProcessor
int nx
 
int ny
 
int nz
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Replace a source image as a Gaussian Blob.

Parameters
sigmasigma value for this Gaussian blob
axisspecify a major axis for asymmetric features
cdistance between focus and the center of an ellipse

Definition at line 8410 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::TestImageGaussian::get_desc ( ) const
inlinevirtual

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns
The description of this processor.

Implements EMAN::Processor.

Definition at line 8420 of file processor.h.

8421 {
8422 return "Replace a source image as a Gaussian Blob";
8423 }

◆ get_name()

virtual string EMAN::TestImageGaussian::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 8415 of file processor.h.

8416 {
8417 return NAME;
8418 }
static const string NAME
Definition: processor.h:8439

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::TestImageGaussian::get_param_types ( ) const
inlinevirtual

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 8430 of file processor.h.

8431 {
8432 TypeDict d;
8433 d.put("sigma", EMObject::FLOAT, "sigma value for this Gaussian blob");
8434 d.put("axis", EMObject::STRING, "specify a major axis for asymmetric features");
8435 d.put("c", EMObject::FLOAT, "distance between focus and the center of an ellipse");
8436 return d;
8437 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

◆ NEW()

static Processor * EMAN::TestImageGaussian::NEW ( )
inlinestatic

Definition at line 8425 of file processor.h.

8426 {
8427 return new TestImageGaussian();
8428 }
Replace a source image as a Gaussian Blob.
Definition: processor.h:8411

◆ process_inplace()

void TestImageGaussian::process_inplace ( EMData image)
virtual

To process an image in-place.

For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.

Parameters
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 9303 of file processor.cpp.

9304{
9305 preprocess(image);
9306
9307 float sigma = params["sigma"];
9308 string axis = (const char*)params["axis"];
9309 float c = params["c"];
9310
9311 float *dat = image->get_data();
9312 float r; //this is the distance of pixel from the image center(nx/2, ny/2, nz/2)
9313 float x2, y2, z2; //this is the coordinates of this pixel from image center
9314 for (int k = 0; k < nz; ++k) {
9315 for (int j = 0; j < ny; ++j) {
9316 for (int i = 0; i < nx; ++i, ++dat) {
9317 x2 = (float)( i - nx/2 );
9318 y2 = (float)( j - ny/2 );
9319 z2 = (float)( k - nz/2 );
9320
9321 if(axis==""){
9322 r = (float)sqrt(x2*x2+y2*y2+z2*z2);
9323 }
9324 else if(axis == "x"){
9325 float lc = -c;
9326 float rc = c;
9327 r = ( (float)sqrt((x2-lc)*(x2-lc)+y2*y2+z2*z2) +
9328 (float)sqrt((x2-rc)*(x2-rc)+y2*y2+z2*z2) ) /2.0f - c;
9329 }
9330 else if(axis == "y"){
9331 float lc = -c;
9332 float rc = c;
9333 r = ( (float)sqrt(x2*x2+(y2-lc)*(y2-lc)+z2*z2) +
9334 (float)sqrt(x2*x2+(y2-rc)*(y2-rc)+z2*z2) ) /2.0f - c;
9335 }
9336 else if(axis == "z"){
9337 if( nz == 1 ){
9338 throw InvalidValueException(0, "This is a 2D image, no asymmetric feature for z axis");
9339 }
9340 float lc = -c;
9341 float rc = c;
9342 r = ( (float)sqrt(x2*x2+y2*y2+(z2-lc)*(z2-lc)) +
9343 (float)sqrt(x2*x2+y2*y2+(z2-rc)*(z2-rc)) ) /2.0f - c;
9344 }
9345 else{
9346 throw InvalidValueException(0, "please specify a valid axis for asymmetric features");
9347 }
9348 //the amplitude of the pixel is proportional to the distance of this pixel from the center
9349 *dat = (float)gsl_ran_gaussian_pdf((double)r,(double)sigma);
9350 }
9351 }
9352 }
9353
9354 image->update();
9355}
void preprocess(EMData *image)
Definition: processor.cpp:8923
EMData * sqrt() const
return square root of current image
#define InvalidValueException(val, desc)
Definition: exception.h:285

References InvalidValueException, EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), and sqrt().

Member Data Documentation

◆ NAME

const string TestImageGaussian::NAME = "testimage.gaussian"
static

Definition at line 8439 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: