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

EMAN::ApplyPolynomialProfileToHelix Class Reference

#include <processor.h>

Inheritance diagram for EMAN::ApplyPolynomialProfileToHelix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

void process_inplace (EMData *in)
 To process an image in-place.
string get_name () const
 Get the processor's name.
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 = "math.poly_radial_profile"

Detailed Description

Definition at line 6890 of file processor.h.


Member Function Documentation

string EMAN::ApplyPolynomialProfileToHelix::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 6905 of file processor.h.

06906                 {
06907                         return "Finds the CM of each z-axis slice and applies a polynomial radial profile about it.";
06908                 }

string EMAN::ApplyPolynomialProfileToHelix::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 6895 of file processor.h.

References NAME.

06896                 {
06897                         return NAME;
06898                 }

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

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

06910                 {
06911                         TypeDict d;
06912                         d.put("length", EMObject::FLOAT, "Helix length in angstroms.");
06913                         d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map");
06914                         return d;
06915                 }

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

Definition at line 6900 of file processor.h.

06901                 {
06902                         return new ApplyPolynomialProfileToHelix();
06903                 }

void ApplyPolynomialProfileToHelix::process_inplace EMData in  )  [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 9900 of file processor.cpp.

References EMAN::EMData::get_attr(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Processor::params, EMAN::ModelHelixProcessor::radprofile(), EMAN::Util::round(), and EMAN::Dict::set_default().

09901 {
09902         EMData * cyl = in;
09903         int nx = cyl->get_xsize();
09904         int ny = cyl->get_ysize();
09905         int nz = cyl->get_zsize();
09906         float apix_x = cyl->get_attr("apix_x"); //TODO: Ask Matt if I correctly handled cases where apix_x != apix_y or apix_x != apix_z are not equal
09907         float apix_y = cyl->get_attr("apix_y");
09908         float apix_z = cyl->get_attr("apix_z");
09909         float lengthAngstroms = params["length"];
09910         int z0 = params.set_default("z0", -1); //in voxels
09911 
09912         if (z0 < 0 || z0 >= nz)
09913                 z0 = nz / 2;
09914 
09915         int z_start = Util::round( z0 - 0.5*lengthAngstroms/apix_z );
09916         int z_stop = Util::round( z0 + 0.5*lengthAngstroms/apix_z );
09917 
09918         float * dat = cyl->get_data();
09919         double rho_x_sum, rho_y_sum, rho_sum, x_cm, y_cm, radius;
09920 
09921         for (int k = 0; k < nz; k++) //taking slices along z axis
09922         {
09923                 rho_x_sum = rho_y_sum = rho_sum = 0; //Set to zero for a new slice
09924 
09925                 if (k >= z_start && k <= z_stop)
09926                 //Apply the radial profile only between z_start and z_stop on the z axis
09927                 {
09928                         //Calculating CM for the slice...
09929                         for (int j = 0; j < ny; j++)
09930                         {
09931                                 for (int i = 0; i < nx; i++, dat++)
09932                                 {
09933                                         rho_x_sum += (*dat)*i;
09934                                         rho_y_sum += (*dat)*j;
09935                                         rho_sum += *dat;
09936                                 }
09937                         }
09938                         if (rho_sum != 0)
09939                         {
09940                                 dat -= nx*ny;//going back to the beginning of the dat array
09941                                 x_cm = rho_x_sum/rho_sum;
09942                                 y_cm = rho_y_sum/rho_sum;
09943 
09944                                 //Applying radial profile...
09945                                 for (int j=0; j<ny;j++)
09946                                 {
09947                                         for (int i=0;i<nx;i++,dat++)
09948                                         {
09949                                                 radius = hypot( (i-x_cm)*apix_x, (j-y_cm)*apix_y );
09950                                                 *dat = radprofile((float)radius, 2);//Type 2 is the polynomial radial profile.
09951                                         }
09952                                 }
09953                         }
09954                 }
09955                 else
09956                 //Clear the map, setting the density to zero everywhere else.
09957                 {
09958                         for (int j=0; j<ny; j++)
09959                                 for(int i=0; i<nx; i++)
09960                                 {
09961                                         *dat = 0;
09962                                         dat++;
09963                                 }
09964                 }
09965 
09966         }
09967 }


Member Data Documentation

const string ApplyPolynomialProfileToHelix::NAME = "math.poly_radial_profile" [static]
 

Definition at line 6917 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:37:57 2010 for EMAN2 by  doxygen 1.4.4