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

EMAN::ModelEMCylinderProcessor Class Reference

#include <processor.h>

Inheritance diagram for EMAN::ModelEMCylinderProcessor:

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

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

ProcessorNEW ()

Static Public Attributes

const string NAME = "math.model_em_cylinder"

Member Function Documentation

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

06908                 {
06909                         return "Adds a cylinder with a radial density profile similar to that of an alpha helix.";
06910                 }

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

06898                 {
06899                         return NAME;
06900                 }

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

References EMAN::TypeDict::put().

06913                 {
06914                         TypeDict d;
06915                         d.put("type", EMObject::INT, "Radial profile of density method, defaults to 2: 0 = pure Gaussian falloff; 1 = Gaussian falloff + dip, so mean is zero; 2 = polynomial fitting of real helix density");
06916                         d.put("length", EMObject::FLOAT, "cylinder length in angstroms, defaults to 3 turns (16.2 Angstroms)");
06917                         d.put("x0", EMObject::INT, "x coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map");
06918                         d.put("y0", EMObject::INT, "y coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map");
06919                         d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map");
06920                         //TODO: Check with Matt Baker about description strings
06921                         return d;
06922                 }

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

Definition at line 6902 of file processor.h.

06903                 {
06904                         return new ModelEMCylinderProcessor();
06905                 }

void ModelEMCylinderProcessor::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 9696 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(), nx, ny, EMAN::ModelHelixProcessor::radprofile(), EMAN::Dict::set_default(), x, and y.

09697               : modified from EMAN1 Cylinder.C by Wen Jiang
09698 {
09699         // synthesize model alpha helix, len is Angstrom, default to 2 turns
09700         //The helical axis is parallel to the z axis.
09701         EMData * cyl = in;
09702         int nx = cyl->get_xsize();
09703         int ny = cyl->get_ysize();
09704         int nz = cyl->get_zsize();
09705 
09706         int type = params.set_default("type", 2);
09707         float len = params.set_default("length", 16.2f); //in angstroms
09708         int x0 = params.set_default("x0", -1); //in voxels -- default value changed a few lines down
09709         int y0 = params.set_default("y0", -1); //in voxels
09710         int z0 = params.set_default("z0", -1); //in voxels
09711         //TODO: check with Matt about default values
09712 
09713         if (x0 < 0 || x0 >= nx)
09714                 x0 = nx / 2;
09715         if (y0 < 0 || y0 >= ny)
09716                 y0 = ny / 2;
09717         if (z0 < 0 || z0 >= nz)
09718                 z0 = nz / 2;
09719 
09720         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
09721         float apix_y = cyl->get_attr("apix_y");
09722         float apix_z = cyl->get_attr("apix_z");
09723 
09724         float * dat = cyl->get_data();
09725         int cyl_voxel_len = (int) (len / apix_z);
09726         int cyl_k_min = z0 - cyl_voxel_len / 2;
09727         int cyl_k_max = z0 + cyl_voxel_len / 2;
09728 
09729         int x, y;
09730         for (int k = 0; k < nz; ++k) {
09731                 for (int j = 0; j < ny; ++j) {
09732                         for (int i = 0; i < nx; ++i, ++dat) {
09733                                 x = i - x0;//coordinate sys centered on cylinder
09734                                 y = j - y0;//coordinate sys centered on cylinder
09735                                 float radius = (float)hypot(x * apix_x, y * apix_y);
09736                                 if ((k > cyl_k_min) && (k < cyl_k_max))
09737                                         *dat += radprofile(radius, type); //pointer arithmetic for array done in loop
09738                                 //else
09739                                         //continue;
09740 
09741                         }
09742                 }
09743         }
09744 }


Member Data Documentation

const string ModelEMCylinderProcessor::NAME = "math.model_em_cylinder" [static]
 

Definition at line 217 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:46:45 2011 for EMAN2 by  doxygen 1.3.9.1