#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 5734 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 5749 of file processor.h. 05750 { 05751 return "Smart mask processor."; 05752 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5739 of file processor.h. 05740 {
05741 return NAME;
05742 }
|
|
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 5754 of file processor.h. References EMAN::TypeDict::put(). 05755 { 05756 TypeDict d; 05757 d.put("mask", EMObject::FLOAT, "mask value"); 05758 return d; 05759 }
|
|
Definition at line 5744 of file processor.h. 05745 { 05746 return new SmartMaskProcessor(); 05747 }
|
|
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 6250 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(). 06251 { 06252 if (!image) { 06253 LOGWARN("NULL Image"); 06254 return; 06255 } 06256 06257 float mask = params["mask"]; 06258 06259 int nx = image->get_xsize(); 06260 int ny = image->get_ysize(); 06261 int nz = image->get_zsize(); 06262 06263 float *dat = image->get_data(); 06264 double sma = 0; 06265 size_t smn = 0; 06266 float r = 0.0f; 06267 for (int k = 0; k < nz; ++k) { 06268 for (int j = 0; j < ny; ++j) { 06269 for (int i = 0; i < nx; ++i, ++dat) { 06270 r = 06271 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06272 Util::square(k - nz / 2)); 06273 if (r > mask - 1.5f && r < mask - 0.5f) { 06274 sma += *dat; 06275 smn++; 06276 } 06277 } 06278 } 06279 } 06280 06281 float smask = (float) (sma / smn); 06282 image->update(); 06283 06284 dat = image->get_data(); 06285 for (int k = 0; k < nz; ++k) { 06286 for (int j = 0; j < ny; ++j) { 06287 for (int i = 0; i < nx; ++i, ++dat) { 06288 r = 06289 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06290 Util::square(k - nz / 2)); 06291 if (r > mask - .5) { 06292 *dat = 0; 06293 } 06294 else { 06295 *dat -= smask; 06296 } 06297 } 06298 } 06299 } 06300 06301 image->update(); 06302 }
|
|
Definition at line 188 of file processor.cpp. |