#include <processor.h>
Inheritance diagram for EMAN::ToMinvalProcessor:
Public Member Functions | |
string | get_name () const |
Get the processor's name. | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
TypeDict | get_param_types () const |
Get processor parameter information in a dictionary. | |
string | get_desc () const |
Get the descrition of this specific processor. | |
Static Public Member Functions | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "threshold.belowtominval" |
minval | Everything below this value is set to this value |
Definition at line 1789 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 1811 of file processor.h. 01812 { 01813 return "f(x) = x if x >= minval; f(x) = minval|newval if x < minval."; 01814 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 1792 of file processor.h. 01793 {
01794 return NAME;
01795 }
|
|
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 1803 of file processor.h. References EMAN::TypeDict::put(). 01804 { 01805 TypeDict d; 01806 d.put("minval", EMObject::FLOAT, "Everything below this value is set to this value"); 01807 d.put("newval", EMObject::FLOAT, "If set, values below minval will be set to newval instead of minval "); 01808 return d; 01809 }
|
|
Definition at line 1796 of file processor.h. 01797 { 01798 return new ToMinvalProcessor(); 01799 }
|
|
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 1581 of file processor.cpp. References data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, EMAN::Dict::set_default(), and EMAN::EMData::update(). 01582 { 01583 if (!image) { 01584 LOGWARN("NULL Image"); 01585 return; 01586 } 01587 01588 float minval = params.set_default("minval",0.0f); 01589 float newval = params.set_default("newval",minval); 01590 01591 size_t size = (size_t)image->get_xsize() * 01592 (size_t)image->get_ysize() * 01593 (size_t)image->get_zsize(); 01594 float *data = image->get_data(); 01595 01596 01597 01598 for (size_t i = 0; i < size; ++i) { 01599 if (data[i]<minval) data[i]=newval; 01600 } 01601 image->update(); 01602 }
|
|
Definition at line 92 of file processor.cpp. |