EMAN::TestImagePureGaussian Class Reference

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

#include <processor.h>

Inheritance diagram for EMAN::TestImagePureGaussian:

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

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.puregaussian"

Detailed Description

Replace a source image as a strict Gaussian.

Parameters:
x_sigma sigma value for this Gaussian blob on x direction
y_sigma sigma value for this Gaussian blob on y direction
z_sigma sigma value for this Gaussian blob on z direction
x_center center for this Gaussian blob on x direction
y_center center for this Gaussian blob on y direction
z_center center for this Gaussian blob on z direction

Definition at line 5867 of file processor.h.


Member Function Documentation

virtual string EMAN::TestImagePureGaussian::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 5877 of file processor.h.

05878                 {
05879                         return "Replace a source image as a strict Gaussian ";
05880                 }

virtual string EMAN::TestImagePureGaussian::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 5872 of file processor.h.

References NAME.

05873                 {
05874                         return NAME;
05875                 }

virtual TypeDict EMAN::TestImagePureGaussian::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 5887 of file processor.h.

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

05888                 {
05889                         TypeDict d;
05890                         d.put("x_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on x direction");
05891                         d.put("y_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on y direction");
05892                         d.put("z_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on z direction");
05893                         d.put("x_center", EMObject::FLOAT, "center for this Gaussian blob on x direction" );
05894                         d.put("y_center", EMObject::FLOAT, "center for this Gaussian blob on y direction" );
05895                         d.put("z_center", EMObject::FLOAT, "center for this Gaussian blob on z direction" );
05896                         return d;
05897                 }

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

Definition at line 5882 of file processor.h.

05883                 {
05884                         return new TestImagePureGaussian();
05885                 }

void TestImagePureGaussian::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 7390 of file processor.cpp.

References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), norm(), EMAN::Processor::params, pi, EMAN::TestImageProcessor::preprocess(), sqrt(), EMAN::EMData::update(), and x.

07391 {
07392         preprocess(image);
07393 
07394         float x_sigma = params["x_sigma"];
07395         float y_sigma = params["y_sigma"];
07396         float z_sigma = params["z_sigma"];
07397 
07398         float x_center = params["x_center"];
07399         float y_center = params["y_center"];
07400         float z_center = params["z_center"];
07401 
07402         int nx = image->get_xsize();
07403         int ny = image->get_ysize();
07404         int nz = image->get_zsize();
07405 
07406         float x_twosig2 = 2*x_sigma*x_sigma;
07407         float y_twosig2 = 2*y_sigma*y_sigma;
07408         float z_twosig2 = 2*z_sigma*z_sigma;
07409 
07410         float sr2pi = sqrt( 2.0f*(float)pi );
07411         float norm  = 1.0f/ ( x_sigma*sr2pi );
07412         if (ny > 1) {
07413                 norm *= 1.0f/ ( y_sigma*sr2pi );
07414                 if (nz > 1) norm  *= 1.0f/ ( z_sigma*sr2pi );
07415         }
07416 
07417         float z, y, x, sum, val;
07418         for (int iz=0; iz < nz; ++iz) {
07419                 z = static_cast<float>(iz) - z_center;
07420                 for (int iy=0; iy < ny; ++iy) {
07421                         y = static_cast<float>(iy) - y_center;
07422                         for (int ix=0; ix < nx; ++ix) {
07423                                 x = static_cast<float>(ix) - x_center;
07424                                 sum = x*x/x_twosig2 + y*y/y_twosig2 + z*z/z_twosig2;
07425                                 val = norm*exp(-sum);
07426                                 (*image)(ix,iy,iz) = val;
07427                         }
07428                 }
07429         }
07430         image->update();
07431 }


Member Data Documentation

const string TestImagePureGaussian::NAME = "testimage.puregaussian" [static]

Definition at line 5899 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Thu May 3 10:10:46 2012 for EMAN2 by  doxygen 1.4.7