#include <processor.h>
Inheritance diagram for EMAN::NormalizeByMassProcessor:
Public Member Functions | |
string | get_name () const |
Get the processor's name. | |
string | get_desc () const |
Get the descrition of this specific processor. | |
TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "normalize.bymass" |
Only works for 3D images. Essentially a replica of Volume.C in EMAN1.
apix | Angstrom per pixel of the image. If not set will use the apix_x attribute of the image | |
mass | The approximate mass of protein/structure in kilodaltons | |
thr | The isosurface threshold which encapsulates the structure |
Definition at line 4234 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 4247 of file processor.h. 04248 { 04249 return "Normalize the mass of the image assuming a density of 1.35 g/ml (0.81 Da/A^3) (3D only)"; 04250 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4237 of file processor.h. 04238 {
04239 return NAME;
04240 }
|
|
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 4252 of file processor.h. References EMAN::TypeDict::put(). 04253 { 04254 TypeDict d; 04255 d.put("apix", EMObject::FLOAT,"Angstrom per pixel of the image. If not set will use the apix_x attribute of the image"); 04256 d.put("mass", EMObject::FLOAT,"The approximate mass of protein/structure in kilodaltons"); 04257 d.put("thr", EMObject::FLOAT,"The isosurface threshold which encapsulates the structure"); 04258 return d; 04259 }
|
|
Definition at line 4242 of file processor.h. 04243 { 04244 return new NormalizeByMassProcessor(); 04245 }
|
|
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 3625 of file processor.cpp. References EMAN::EMData::get_attr(), EMAN::EMData::get_attr_default(), EMAN::EMData::get_data(), EMAN::EMData::get_size(), InvalidParameterException, max, min, EMAN::EMData::mult(), EMAN::Dict::set_default(), and EMAN::EMData::update(). 03626 { 03627 float mass = params.set_default("mass",-1.0f); 03628 03629 if (mass <= 0) throw InvalidParameterException("You must specify a positive non zero mass"); 03630 03631 float thr = params.set_default("thr",(float)image->get_attr("mean")+(float)image->get_attr("sigma")); 03632 03633 float apix = image->get_attr_default("apix_x",1.0f); 03634 apix = params.set_default("apix",apix); 03635 03636 if (apix <= 0) throw InvalidParameterException("You must specify a positive non zero apix"); 03637 03638 float step = ((float)image->get_attr("sigma"))/2.0f; 03639 03640 int count=0; 03641 size_t n = image->get_size(); 03642 float* d = image->get_data(); 03643 03644 for (size_t i=0; i<n; ++i) { 03645 if (d[i]>=thr) ++count; 03646 } 03647 03648 float max = image->get_attr("maximum"); 03649 float min = image->get_attr("minimum"); 03650 for (int j=0; j<4; j++) { 03651 while (thr<max && count*apix*apix*apix*.81/1000.0>mass) { 03652 thr+=step; 03653 count=0; 03654 for (size_t i=0; i<n; ++i) { 03655 if (d[i]>=thr) ++count; 03656 } 03657 } 03658 03659 step/=4.0; 03660 03661 while (thr>min && count*apix*apix*apix*.81/1000.0<mass) { 03662 thr-=step; 03663 count=0; 03664 for (size_t i=0; i<n; ++i) { 03665 if (d[i]>=thr) ++count; 03666 } 03667 } 03668 03669 step/=4.0; 03670 } 03671 03672 image->mult((float)1.0/thr); 03673 image->update(); 03674 }
|
|
Definition at line 148 of file processor.cpp. |