#include <processor.h>
Inheritance diagram for EMAN::ApplyPolynomialProfileToHelix:


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.poly_radial_profile" |
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 6873 of file processor.h. 06874 {
06875 return "Finds the CM of each z-axis slice and applies a polynomial radial profile about it.";
06876 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6863 of file processor.h. 06864 {
06865 return NAME;
06866 }
|
|
|
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 6877 of file processor.h. References EMAN::TypeDict::put(). 06878 {
06879 TypeDict d;
06880 d.put("length", EMObject::FLOAT, "Helix length in angstroms.");
06881 d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map");
06882 return d;
06883 }
|
|
|
Definition at line 6868 of file processor.h. 06869 {
06870 return new ApplyPolynomialProfileToHelix();
06871 }
|
|
|
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 9628 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::Util::round(), and EMAN::Dict::set_default(). 09629 {
09630 EMData * cyl = in;
09631 int nx = cyl->get_xsize();
09632 int ny = cyl->get_ysize();
09633 int nz = cyl->get_zsize();
09634 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
09635 float apix_y = cyl->get_attr("apix_y");
09636 float apix_z = cyl->get_attr("apix_z");
09637 float lengthAngstroms = params["length"];
09638 int z0 = params.set_default("z0", -1); //in voxels
09639
09640 if (z0 < 0 || z0 >= nz)
09641 z0 = nz / 2;
09642
09643 int z_start = Util::round( z0 - 0.5*lengthAngstroms/apix_z );
09644 int z_stop = Util::round( z0 + 0.5*lengthAngstroms/apix_z );
09645
09646 float * dat = cyl->get_data();
09647 double rho_x_sum, rho_y_sum, rho_sum, x_cm, y_cm, radius;
09648
09649 for (int k = 0; k < nz; ++k) //taking slices along z axis
09650 {
09651 rho_x_sum = rho_y_sum = rho_sum = 0; //Set to zero for a new slice
09652
09653 if (k >= z_start && k <= z_stop)
09654 //Apply the radial profile only between z_start and z_stop on the z axis
09655 {
09656 //Calculating CM for the slice...
09657 for (int j = 0; j < ny; ++j)
09658 {
09659 for (int i = 0; i < nx; ++i, ++dat)
09660 {
09661 rho_x_sum += (*dat)*i;
09662 rho_y_sum += (*dat)*j;
09663 rho_sum += *dat;
09664 }
09665 }
09666 if (rho_sum != 0)
09667 {
09668 dat -= nx*ny;//going back to the beginning of the dat array
09669 x_cm = rho_x_sum/rho_sum;
09670 y_cm = rho_y_sum/rho_sum;
09671
09672 //Applying radial profile...
09673 for (int j=0; j<ny;++j)
09674 {
09675 for (int i=0;i<nx;++i,++dat)
09676 {
09677 radius = hypot( (i-x_cm)*apix_x, (j-y_cm)*apix_y );
09678 *dat = radprofile((float)radius, 2);//Type 2 is the polynomial radial profile.
09679 }
09680 }
09681 }
09682 }
09683 else
09684 //Clear the map, setting the density to zero everywhere else.
09685 {
09686 for (int j=0; j<ny; j++)
09687 for(int i=0; i<nx; i++)
09688 {
09689 *dat = 0;
09690 dat++;
09691 }
09692 }
09693
09694 }
09695 }
|
|
|
Definition at line 218 of file processor.cpp. |
1.3.9.1