Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::TestImagePureGaussian Class Reference

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

#include <processor.h>

Inheritance diagram for EMAN::TestImagePureGaussian:

[legend]
Collaboration diagram for EMAN::TestImagePureGaussian:
[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

ProcessorNEW ()

Static Public Attributes

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

05795                 {
05796                         return "Replace a source image as a strict Gaussian ";
05797                 }

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

05790                 {
05791                         return NAME;
05792                 }

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

References EMAN::TypeDict::put().

05805                 {
05806                         TypeDict d;
05807                         d.put("x_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on x direction");
05808                         d.put("y_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on y direction");
05809                         d.put("z_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on z direction");
05810                         d.put("x_center", EMObject::FLOAT, "center for this Gaussian blob on x direction" );
05811                         d.put("y_center", EMObject::FLOAT, "center for this Gaussian blob on y direction" );
05812                         d.put("z_center", EMObject::FLOAT, "center for this Gaussian blob on z direction" );
05813                         return d;
05814                 }

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

Definition at line 5799 of file processor.h.

05800                 {
05801                         return new TestImagePureGaussian();
05802                 }

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 7102 of file processor.cpp.

References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), norm(), nx, ny, pi, EMAN::TestImageProcessor::preprocess(), sqrt(), EMAN::EMData::update(), x, and y.

07103 {
07104         preprocess(image);
07105 
07106         float x_sigma = params["x_sigma"];
07107         float y_sigma = params["y_sigma"];
07108         float z_sigma = params["z_sigma"];
07109 
07110         float x_center = params["x_center"];
07111         float y_center = params["y_center"];
07112         float z_center = params["z_center"];
07113 
07114         int nx = image->get_xsize();
07115         int ny = image->get_ysize();
07116         int nz = image->get_zsize();
07117 
07118         float x_twosig2 = 2*x_sigma*x_sigma;
07119         float y_twosig2 = 2*y_sigma*y_sigma;
07120         float z_twosig2 = 2*z_sigma*z_sigma;
07121 
07122         float sr2pi = sqrt( 2.0f*(float)pi );
07123         float norm  = 1.0f/ ( x_sigma*sr2pi );
07124         if (ny > 1) {
07125                 norm *= 1.0f/ ( y_sigma*sr2pi );
07126                 if (nz > 1) norm  *= 1.0f/ ( z_sigma*sr2pi );
07127         }
07128 
07129         float z, y, x, sum, val;
07130         for (int iz=0; iz < nz; ++iz) {
07131                 z = static_cast<float>(iz) - z_center;
07132                 for (int iy=0; iy < ny; ++iy) {
07133                         y = static_cast<float>(iy) - y_center;
07134                         for (int ix=0; ix < nx; ++ix) {
07135                                 x = static_cast<float>(ix) - x_center;
07136                                 sum = x*x/x_twosig2 + y*y/y_twosig2 + z*z/z_twosig2;
07137                                 val = norm*exp(-sum);
07138                                 (*image)(ix,iy,iz) = val;
07139                         }
07140                 }
07141         }
07142         image->update();
07143 }


Member Data Documentation

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

Definition at line 190 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:27 2010 for EMAN2 by  doxygen 1.3.9.1