EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
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_sigmasigma value for this Gaussian blob on x direction
y_sigmasigma value for this Gaussian blob on y direction
z_sigmasigma value for this Gaussian blob on z direction
x_centercenter for this Gaussian blob on x direction
y_centercenter for this Gaussian blob on y direction
z_centercenter for this Gaussian blob on z direction

Definition at line 6280 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 6290 of file processor.h.

                {
                        return "Replace a source image as a strict Gaussian ";
                }
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 6285 of file processor.h.

References NAME.

                {
                        return NAME;
                }
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 6300 of file processor.h.

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

                {
                        TypeDict d;
                        d.put("x_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on x direction");
                        d.put("y_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on y direction");
                        d.put("z_sigma", EMObject::FLOAT, "sigma value for this Gaussian blob on z direction");
                        d.put("x_center", EMObject::FLOAT, "center for this Gaussian blob on x direction" );
                        d.put("y_center", EMObject::FLOAT, "center for this Gaussian blob on y direction" );
                        d.put("z_center", EMObject::FLOAT, "center for this Gaussian blob on z direction" );
                        return d;
                }
static Processor* EMAN::TestImagePureGaussian::NEW ( ) [inline, static]

Definition at line 6295 of file processor.h.

                {
                        return new TestImagePureGaussian();
                }
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:
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 7908 of file processor.cpp.

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

{
        preprocess(image);

        float x_sigma = params["x_sigma"];
        float y_sigma = params["y_sigma"];
        float z_sigma = params["z_sigma"];

        float x_center = params["x_center"];
        float y_center = params["y_center"];
        float z_center = params["z_center"];

        int nx = image->get_xsize();
        int ny = image->get_ysize();
        int nz = image->get_zsize();

        float x_twosig2 = 2*x_sigma*x_sigma;
        float y_twosig2 = 2*y_sigma*y_sigma;
        float z_twosig2 = 2*z_sigma*z_sigma;

        float sr2pi = sqrt( 2.0f*(float)pi );
        float norm  = 1.0f/ ( x_sigma*sr2pi );
        if (ny > 1) {
                norm *= 1.0f/ ( y_sigma*sr2pi );
                if (nz > 1) norm  *= 1.0f/ ( z_sigma*sr2pi );
        }

        float z, y, x, sum, val;
        for (int iz=0; iz < nz; ++iz) {
                z = static_cast<float>(iz) - z_center;
                for (int iy=0; iy < ny; ++iy) {
                        y = static_cast<float>(iy) - y_center;
                        for (int ix=0; ix < nx; ++ix) {
                                x = static_cast<float>(ix) - x_center;
                                sum = x*x/x_twosig2 + y*y/y_twosig2 + z*z/z_twosig2;
                                val = norm*exp(-sum);
                                (*image)(ix,iy,iz) = val;
                        }
                }
        }
        image->update();
}

Member Data Documentation

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

Definition at line 6312 of file processor.h.

Referenced by get_name().


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