#include <processor.h>
Inheritance diagram for EMAN::SmartMaskProcessor:
Public Member Functions | |
virtual void | process_inplace (EMData *image) |
To process an image in-place. | |
virtual string | get_name () const |
Get the processor's name. | |
virtual 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 = "mask.smart" |
mask | mask value |
Definition at line 5524 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 5539 of file processor.h. 05540 { 05541 return "Smart mask processor."; 05542 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5529 of file processor.h. 05530 {
05531 return NAME;
05532 }
|
|
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 5544 of file processor.h. References EMAN::TypeDict::put(). 05545 { 05546 TypeDict d; 05547 d.put("mask", EMObject::FLOAT, "mask value"); 05548 return d; 05549 }
|
|
Definition at line 5534 of file processor.h. 05535 { 05536 return new SmartMaskProcessor(); 05537 }
|
|
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 6070 of file processor.cpp. References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, nx, ny, sqrt(), and EMAN::EMData::update(). 06071 { 06072 if (!image) { 06073 LOGWARN("NULL Image"); 06074 return; 06075 } 06076 06077 float mask = params["mask"]; 06078 06079 int nx = image->get_xsize(); 06080 int ny = image->get_ysize(); 06081 int nz = image->get_zsize(); 06082 06083 float *dat = image->get_data(); 06084 double sma = 0; 06085 int smn = 0; 06086 float r = 0.0f; 06087 for (int k = 0; k < nz; ++k) { 06088 for (int j = 0; j < ny; ++j) { 06089 for (int i = 0; i < nx; ++i, ++dat) { 06090 r = 06091 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06092 Util::square(k - nz / 2)); 06093 if (r > mask - 1.5f && r < mask - 0.5f) { 06094 sma += *dat; 06095 smn++; 06096 } 06097 } 06098 } 06099 } 06100 06101 float smask = (float) sma / smn; 06102 image->update(); 06103 06104 dat = image->get_data(); 06105 for (int k = 0; k < nz; ++k) { 06106 for (int j = 0; j < ny; ++j) { 06107 for (int i = 0; i < nx; ++i, ++dat) { 06108 r = 06109 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06110 Util::square(k - nz / 2)); 06111 if (r > mask - .5) { 06112 *dat = 0; 06113 } 06114 else { 06115 *dat -= smask; 06116 } 06117 } 06118 } 06119 } 06120 06121 image->update(); 06122 }
|
|
Definition at line 183 of file processor.cpp. |