#include <processor.h>
Inheritance diagram for EMAN::ModelEMCylinderProcessor:
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 Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "math.model_em_cylinder" |
Definition at line 6937 of file processor.h.
string EMAN::ModelEMCylinderProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 6952 of file processor.h.
06953 { 06954 return "Adds a cylinder with a radial density profile similar to that of an alpha helix."; 06955 }
string EMAN::ModelEMCylinderProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 6942 of file processor.h.
References NAME.
06943 { 06944 return NAME; 06945 }
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.
Reimplemented from EMAN::Processor.
Definition at line 6957 of file processor.h.
References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().
06958 { 06959 TypeDict d; 06960 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"); 06961 d.put("length", EMObject::FLOAT, "cylinder length in angstroms, defaults to 3 turns (16.2 Angstroms)"); 06962 d.put("x0", EMObject::INT, "x coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map"); 06963 d.put("y0", EMObject::INT, "y coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map"); 06964 d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map"); 06965 //TODO: Check with Matt Baker about description strings 06966 return d; 06967 }
static Processor* EMAN::ModelEMCylinderProcessor::NEW | ( | ) | [inline, static] |
Definition at line 6947 of file processor.h.
06948 { 06949 return new ModelEMCylinderProcessor(); 06950 }
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 9768 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(), in, EMAN::Processor::params, EMAN::ModelHelixProcessor::radprofile(), EMAN::Dict::set_default(), and x.
09769 : modified from EMAN1 Cylinder.C by Wen Jiang 09770 { 09771 // synthesize model alpha helix, len is Angstrom, default to 2 turns 09772 //The helical axis is parallel to the z axis. 09773 EMData * cyl = in; 09774 int nx = cyl->get_xsize(); 09775 int ny = cyl->get_ysize(); 09776 int nz = cyl->get_zsize(); 09777 09778 int type = params.set_default("type", 2); 09779 float len = params.set_default("length", 16.2f); //in angstroms 09780 int x0 = params.set_default("x0", -1); //in voxels -- default value changed a few lines down 09781 int y0 = params.set_default("y0", -1); //in voxels 09782 int z0 = params.set_default("z0", -1); //in voxels 09783 //TODO: check with Matt about default values 09784 09785 if (x0 < 0 || x0 >= nx) 09786 x0 = nx / 2; 09787 if (y0 < 0 || y0 >= ny) 09788 y0 = ny / 2; 09789 if (z0 < 0 || z0 >= nz) 09790 z0 = nz / 2; 09791 09792 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 09793 float apix_y = cyl->get_attr("apix_y"); 09794 float apix_z = cyl->get_attr("apix_z"); 09795 09796 float * dat = cyl->get_data(); 09797 int cyl_voxel_len = (int) (len / apix_z); 09798 int cyl_k_min = z0 - cyl_voxel_len / 2; 09799 int cyl_k_max = z0 + cyl_voxel_len / 2; 09800 09801 int x, y; 09802 for (int k = 0; k < nz; ++k) { 09803 for (int j = 0; j < ny; ++j) { 09804 for (int i = 0; i < nx; ++i, ++dat) { 09805 x = i - x0;//coordinate sys centered on cylinder 09806 y = j - y0;//coordinate sys centered on cylinder 09807 float radius = (float)hypot(x * apix_x, y * apix_y); 09808 if ((k > cyl_k_min) && (k < cyl_k_max)) 09809 *dat += radprofile(radius, type); //pointer arithmetic for array done in loop 09810 //else 09811 //continue; 09812 09813 } 09814 } 09815 } 09816 }
const string ModelEMCylinderProcessor::NAME = "math.model_em_cylinder" [static] |