#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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "math.model_em_cylinder" |
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 6993 of file processor.h. 06994 { 06995 return "Adds a cylinder with a radial density profile similar to that of an alpha helix."; 06996 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6983 of file processor.h. 06984 {
06985 return NAME;
06986 }
|
|
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 6998 of file processor.h. References EMAN::TypeDict::put(). 06999 { 07000 TypeDict d; 07001 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"); 07002 d.put("length", EMObject::FLOAT, "cylinder length in angstroms, defaults to 3 turns (16.2 Angstroms)"); 07003 d.put("x0", EMObject::INT, "x coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map"); 07004 d.put("y0", EMObject::INT, "y coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map"); 07005 d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map"); 07006 //TODO: Check with Matt Baker about description strings 07007 return d; 07008 }
|
|
Definition at line 6988 of file processor.h. 06989 { 06990 return new ModelEMCylinderProcessor(); 06991 }
|
|
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.
Implements EMAN::Processor. Definition at line 9846 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. 09847 : modified from EMAN1 Cylinder.C by Wen Jiang 09848 { 09849 // synthesize model alpha helix, len is Angstrom, default to 2 turns 09850 //The helical axis is parallel to the z axis. 09851 EMData * cyl = in; 09852 int nx = cyl->get_xsize(); 09853 int ny = cyl->get_ysize(); 09854 int nz = cyl->get_zsize(); 09855 09856 int type = params.set_default("type", 2); 09857 float len = params.set_default("length", 16.2f); //in angstroms 09858 int x0 = params.set_default("x0", -1); //in voxels -- default value changed a few lines down 09859 int y0 = params.set_default("y0", -1); //in voxels 09860 int z0 = params.set_default("z0", -1); //in voxels 09861 //TODO: check with Matt about default values 09862 09863 if (x0 < 0 || x0 >= nx) 09864 x0 = nx / 2; 09865 if (y0 < 0 || y0 >= ny) 09866 y0 = ny / 2; 09867 if (z0 < 0 || z0 >= nz) 09868 z0 = nz / 2; 09869 09870 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 09871 float apix_y = cyl->get_attr("apix_y"); 09872 float apix_z = cyl->get_attr("apix_z"); 09873 09874 float * dat = cyl->get_data(); 09875 int cyl_voxel_len = (int) (len / apix_z); 09876 int cyl_k_min = z0 - cyl_voxel_len / 2; 09877 int cyl_k_max = z0 + cyl_voxel_len / 2; 09878 09879 int x, y; 09880 for (int k = 0; k < nz; ++k) { 09881 for (int j = 0; j < ny; ++j) { 09882 for (int i = 0; i < nx; ++i, ++dat) { 09883 x = i - x0;//coordinate sys centered on cylinder 09884 y = j - y0;//coordinate sys centered on cylinder 09885 float radius = (float)hypot(x * apix_x, y * apix_y); 09886 if ((k > cyl_k_min) && (k < cyl_k_max)) 09887 *dat += radprofile(radius, type); //pointer arithmetic for array done in loop 09888 //else 09889 //continue; 09890 09891 } 09892 } 09893 } 09894 }
|
|
Definition at line 218 of file processor.cpp. |