#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 4165 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 4178 of file processor.h. 04179 {
04180 return "Normalize the mass of the image assuming a density of 1.35 g/ml (0.81 Da/A^3) (3D only)";
04181 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 4168 of file processor.h. 04169 {
04170 return NAME;
04171 }
|
|
|
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 4183 of file processor.h. References EMAN::TypeDict::put(). 04184 {
04185 TypeDict d;
04186 d.put("apix", EMObject::FLOAT,"Angstrom per pixel of the image. If not set will use the apix_x attribute of the image");
04187 d.put("mass", EMObject::FLOAT,"The approximate mass of protein/structure in kilodaltons");
04188 d.put("thr", EMObject::FLOAT,"The isosurface threshold which encapsulates the structure");
04189 return d;
04190 }
|
|
|
Definition at line 4173 of file processor.h. 04174 {
04175 return new NormalizeByMassProcessor();
04176 }
|
|
|
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 3578 of file processor.cpp. References EMAN::EMObject::f, EMAN::EMData::get_attr(), EMAN::EMData::get_data(), EMAN::EMData::get_size(), EMAN::EMData::has_attr(), InvalidParameterException, max, min, EMAN::EMData::mult(), EMAN::Dict::set_default(), and EMAN::EMData::update(). 03579 {
03580 float mass = params.set_default("mass",-1.0f);
03581
03582 if (mass <= 0) throw InvalidParameterException("You must specify a positive non zero mass");
03583
03584 float thr = params.set_default("thr",(float)image->get_attr("mean")+(float)image->get_attr("sigma"));
03585
03586 float apix = params.set_default("apix",-1.123456789f);
03587 if (apix == -1.123456789 ) {
03588 if (image->has_attr("apix_x")) {
03589 apix = image->get_attr("apix_x");
03590 }
03591 }
03592
03593 if (apix <= 0) throw InvalidParameterException("You must specify a positive non zero apix");
03594
03595 float step = ((float)image->get_attr("sigma"))/2.0f;
03596
03597 int count=0;
03598 size_t n = image->get_size();
03599 float* d = image->get_data();
03600
03601 for (size_t i=0; i<n; ++i) {
03602 if (d[i]>=thr) ++count;
03603 }
03604
03605 float max = image->get_attr("maximum");
03606 float min = image->get_attr("minimum");
03607 for (int j=0; j<4; j++) {
03608 while (thr<max && count*apix*apix*apix*.81/1000.0>mass) {
03609 thr+=step;
03610 count=0;
03611 for (size_t i=0; i<n; ++i) {
03612 if (d[i]>=thr) ++count;
03613 }
03614 }
03615
03616 step/=4.0;
03617
03618 while (thr>min && count*apix*apix*apix*.81/1000.0<mass) {
03619 thr-=step;
03620 count=0;
03621 for (size_t i=0; i<n; ++i) {
03622 if (d[i]>=thr) ++count;
03623 }
03624 }
03625
03626 step/=4.0;
03627 }
03628
03629 image->mult((float)1.0/thr);
03630 image->update();
03631 }
|
|
|
Definition at line 147 of file processor.cpp. |
1.3.9.1