#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 5703 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 5718 of file processor.h. 05719 { 05720 return "Smart mask processor."; 05721 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5708 of file processor.h. 05709 {
05710 return NAME;
05711 }
|
|
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 5723 of file processor.h. References EMAN::TypeDict::put(). 05724 { 05725 TypeDict d; 05726 d.put("mask", EMObject::FLOAT, "mask value"); 05727 return d; 05728 }
|
|
Definition at line 5713 of file processor.h. 05714 { 05715 return new SmartMaskProcessor(); 05716 }
|
|
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 6164 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(). 06165 { 06166 if (!image) { 06167 LOGWARN("NULL Image"); 06168 return; 06169 } 06170 06171 float mask = params["mask"]; 06172 06173 int nx = image->get_xsize(); 06174 int ny = image->get_ysize(); 06175 int nz = image->get_zsize(); 06176 06177 float *dat = image->get_data(); 06178 double sma = 0; 06179 size_t smn = 0; 06180 float r = 0.0f; 06181 for (int k = 0; k < nz; ++k) { 06182 for (int j = 0; j < ny; ++j) { 06183 for (int i = 0; i < nx; ++i, ++dat) { 06184 r = 06185 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06186 Util::square(k - nz / 2)); 06187 if (r > mask - 1.5f && r < mask - 0.5f) { 06188 sma += *dat; 06189 smn++; 06190 } 06191 } 06192 } 06193 } 06194 06195 float smask = (float) (sma / smn); 06196 image->update(); 06197 06198 dat = image->get_data(); 06199 for (int k = 0; k < nz; ++k) { 06200 for (int j = 0; j < ny; ++j) { 06201 for (int i = 0; i < nx; ++i, ++dat) { 06202 r = 06203 sqrt((float) Util::square(i - nx / 2) + Util::square(j - ny / 2) + 06204 Util::square(k - nz / 2)); 06205 if (r > mask - .5) { 06206 *dat = 0; 06207 } 06208 else { 06209 *dat -= smask; 06210 } 06211 } 06212 } 06213 } 06214 06215 image->update(); 06216 }
|
|
Definition at line 193 of file processor.cpp. |