#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "mask.smart" |
mask | mask value |
Definition at line 5737 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 5752 of file processor.h.
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5742 of file processor.h. References NAME. 05743 { 05744 return NAME; 05745 }
|
|
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 5757 of file processor.h. References EMAN::EMObject::FLOAT, and EMAN::TypeDict::put(). 05758 { 05759 TypeDict d; 05760 d.put("mask", EMObject::FLOAT, "mask value"); 05761 return d; 05762 }
|
|
Definition at line 5747 of file processor.h. 05748 { 05749 return new SmartMaskProcessor(); 05750 }
|
|
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 6208 of file processor.cpp. References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, EMAN::Processor::params, sqrt(), EMAN::Util::square(), and EMAN::EMData::update(). 06209 { 06210 if (!image) { 06211 LOGWARN("NULL Image"); 06212 return; 06213 } 06214 06215 float mask = params["mask"]; 06216 06217 int nx = image->get_xsize(); 06218 int ny = image->get_ysize(); 06219 int nz = image->get_zsize(); 06220 06221 float *dat = image->get_data(); 06222 double sma = 0; 06223 int smn = 0; 06224 float r = 0.0f; 06225 for (int k = 0; k < nz; ++k) { 06226 for (int j = 0; j < ny; ++j) { 06227 for (int i = 0; i < nx; ++i, ++dat) { 06228 r = 06229 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06230 Util::square(k - nz / 2)); 06231 if (r > mask - 1.5f && r < mask - 0.5f) { 06232 sma += *dat; 06233 smn++; 06234 } 06235 } 06236 } 06237 } 06238 06239 float smask = (float) sma / smn; 06240 image->update(); 06241 06242 dat = image->get_data(); 06243 for (int k = 0; k < nz; ++k) { 06244 for (int j = 0; j < ny; ++j) { 06245 for (int i = 0; i < nx; ++i, ++dat) { 06246 r = 06247 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06248 Util::square(k - nz / 2)); 06249 if (r > mask - .5) { 06250 *dat = 0; 06251 } 06252 else { 06253 *dat -= smask; 06254 } 06255 } 06256 } 06257 } 06258 06259 image->update(); 06260 }
|
|
Definition at line 5764 of file processor.h. Referenced by get_name(). |