#include <processor.h>


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 () |
Definition at line 6481 of file processor.h.
| void ApplyPolynomialProfileToHelix::process_inplace | ( | EMData * | image | ) | [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 9487 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().
09488 { 09489 EMData * cyl = in; 09490 int nx = cyl->get_xsize(); 09491 int ny = cyl->get_ysize(); 09492 int nz = cyl->get_zsize(); 09493 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 09494 float apix_y = cyl->get_attr("apix_y"); 09495 float apix_z = cyl->get_attr("apix_z"); 09496 float lengthAngstroms = params["len"]; 09497 int z0 = params.set_default("z0", -1); //in voxels 09498 09499 if (z0 < 0 || z0 >= nz) 09500 z0 = nz / 2; 09501 09502 int z_start = Util::round( z0 - 0.5*lengthAngstroms/apix_z ); 09503 int z_stop = Util::round( z0 + 0.5*lengthAngstroms/apix_z ); 09504 09505 float * dat = cyl->get_data(); 09506 double rho_x_sum, rho_y_sum, rho_sum, x_cm, y_cm, radius; 09507 09508 for (int k = 0; k < nz; k++) //taking slices along z axis 09509 { 09510 rho_x_sum = rho_y_sum = rho_sum = 0; //Set to zero for a new slice 09511 09512 if (k >= z_start && k <= z_stop) 09513 //Apply the radial profile only between z_start and z_stop on the z axis 09514 { 09515 //Calculating CM for the slice... 09516 for (int j = 0; j < ny; j++) 09517 { 09518 for (int i = 0; i < nx; i++, dat++) 09519 { 09520 rho_x_sum += (*dat)*i; 09521 rho_y_sum += (*dat)*j; 09522 rho_sum += *dat; 09523 } 09524 } 09525 if (rho_sum != 0) 09526 { 09527 dat -= nx*ny;//going back to the beginning of the dat array 09528 x_cm = rho_x_sum/rho_sum; 09529 y_cm = rho_y_sum/rho_sum; 09530 09531 //Applying radial profile... 09532 for (int j=0; j<ny;j++) 09533 { 09534 for (int i=0;i<nx;i++,dat++) 09535 { 09536 radius = hypot( (i-x_cm)*apix_x, (j-y_cm)*apix_y ); 09537 *dat = radprofile((float)radius, 2);//Type 2 is the polynomial radial profile. 09538 } 09539 } 09540 } 09541 } 09542 else 09543 //Clear the map, setting the density to zero everywhere else. 09544 { 09545 for (int j=0; j<ny; j++) 09546 for(int i=0; i<nx; i++) 09547 { 09548 *dat = 0; 09549 dat++; 09550 } 09551 } 09552 09553 } 09554 }
| string EMAN::ApplyPolynomialProfileToHelix::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 6486 of file processor.h.
| static Processor* EMAN::ApplyPolynomialProfileToHelix::NEW | ( | ) | [inline, static] |
Definition at line 6491 of file processor.h.
06492 { 06493 return new ApplyPolynomialProfileToHelix(); 06494 }
| string EMAN::ApplyPolynomialProfileToHelix::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 6496 of file processor.h.
06497 { 06498 return "Finds the CM of each z-axis slice and applies a polynomial radial profile about it."; 06499 }
| 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.
Reimplemented from EMAN::Processor.
Definition at line 6500 of file processor.h.
References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().
06501 { 06502 TypeDict d; 06503 d.put("len", EMObject::FLOAT, "Helix length in angstroms."); 06504 d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis"); 06505 return d; 06506 }
1.5.6