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]
List of all members.

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place.
virtual string get_name () const
 Get the processor's name.
virtual string get_desc () const
 Get the descrition of this specific processor.
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "testimage.gaussian"

Detailed Description

Replace a source image as a Gaussian Blob.

Parameters:
sigma sigma value for this Gaussian blob
axis specify a major axis for asymmetric features
c distance between focus and the center of an ellipse

Definition at line 6125 of file processor.h.


Member Function Documentation

virtual string EMAN::TestImageGaussian::get_desc (  )  const [inline, virtual]

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 6135 of file processor.h.

06136                 {
06137                         return "Replace a source image as a Gaussian Blob";
06138                 }

virtual string EMAN::TestImageGaussian::get_name (  )  const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 6130 of file processor.h.

References NAME.

06131                 {
06132                         return NAME;
06133                 }

virtual TypeDict EMAN::TestImageGaussian::get_param_types (  )  const [inline, virtual]

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 6145 of file processor.h.

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

06146                 {
06147                         TypeDict d;
06148                         d.put("sigma", EMObject::FLOAT, "sigma value for this Gaussian blob");
06149                         d.put("axis", EMObject::STRING, "specify a major axis for asymmetric features");
06150                         d.put("c", EMObject::FLOAT, "distance between focus and the center of an ellipse");
06151                         return d;
06152                 }

static Processor* EMAN::TestImageGaussian::NEW (  )  [inline, static]

Definition at line 6140 of file processor.h.

06141                 {
06142                         return new TestImageGaussian();
06143                 }

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:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 7030 of file processor.cpp.

References EMAN::EMData::get_data(), InvalidValueException, EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), sqrt(), and EMAN::EMData::update().

07031 {
07032         preprocess(image);
07033 
07034         float sigma = params["sigma"];
07035         string axis = (const char*)params["axis"];
07036         float c = params["c"];
07037 
07038         float *dat = image->get_data();
07039         float r; //this is the distance of pixel from the image center(nx/2, ny/2, nz/2)
07040         float x2, y2, z2; //this is the coordinates of this pixel from image center
07041         for (int k = 0; k < nz; ++k) {
07042                 for (int j = 0; j < ny; ++j) {
07043                         for (int i = 0; i < nx; ++i, ++dat) {
07044                                 x2 = (float)( i - nx/2 );
07045                                 y2 = (float)( j - ny/2 );
07046                                 z2 = (float)( k - nz/2 );
07047 
07048                                 if(axis==""){
07049                                         r = (float)sqrt(x2*x2+y2*y2+z2*z2);
07050                                 }
07051                                 else if(axis == "x"){
07052                                         float lc = -c;
07053                                         float rc = c;
07054                                         r = ( (float)sqrt((x2-lc)*(x2-lc)+y2*y2+z2*z2) +
07055                                                   (float)sqrt((x2-rc)*(x2-rc)+y2*y2+z2*z2) ) /2.0f - c;
07056                                 }
07057                                 else if(axis == "y"){
07058                                         float lc = -c;
07059                                         float rc = c;
07060                                         r = ( (float)sqrt(x2*x2+(y2-lc)*(y2-lc)+z2*z2) +
07061                                                   (float)sqrt(x2*x2+(y2-rc)*(y2-rc)+z2*z2) ) /2.0f - c;
07062                                 }
07063                                 else if(axis == "z"){
07064                                         if( nz == 1 ){
07065                                                 throw InvalidValueException(0, "This is a 2D image, no asymmetric feature for z axis");
07066                                         }
07067                                         float lc = -c;
07068                                         float rc = c;
07069                                         r = ( (float)sqrt(x2*x2+y2*y2+(z2-lc)*(z2-lc)) +
07070                                                   (float)sqrt(x2*x2+y2*y2+(z2-rc)*(z2-rc)) ) /2.0f - c;
07071                                 }
07072                                 else{
07073                                         throw InvalidValueException(0, "please specify a valid axis for asymmetric features");
07074                                 }
07075                                 //the amplitude of the pixel is proportional to the distance of this pixel from the center
07076                                 *dat = (float)gsl_ran_gaussian_pdf((double)r,(double)sigma);
07077                         }
07078                 }
07079         }
07080 
07081         image->update();
07082 }


Member Data Documentation

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

Definition at line 6154 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:44:07 2010 for EMAN2 by  doxygen 1.4.7