#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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "threshold.belowtominval" |
minval | Everything below this value is set to this value |
Definition at line 1791 of file processor.h.
string EMAN::ToMinvalProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 1813 of file processor.h.
string EMAN::ToMinvalProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 1794 of file processor.h.
References NAME.
01795 { 01796 return NAME; 01797 }
TypeDict EMAN::ToMinvalProcessor::get_param_types | ( | ) | const [inline, virtual] |
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 1805 of file processor.h.
References EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().
01806 { 01807 TypeDict d; 01808 d.put("minval", EMObject::FLOAT, "Everything below this value is set to this value"); 01809 d.put("newval", EMObject::FLOAT, "If set, values below minval will be set to newval instead of minval "); 01810 return d; 01811 }
static Processor* EMAN::ToMinvalProcessor::NEW | ( | ) | [inline, static] |
void ToMinvalProcessor::process_inplace | ( | EMData * | image | ) | [virtual] |
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 1583 of file processor.cpp.
References data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, EMAN::Processor::params, EMAN::Dict::set_default(), and EMAN::EMData::update().
01584 { 01585 if (!image) { 01586 LOGWARN("NULL Image"); 01587 return; 01588 } 01589 01590 float minval = params.set_default("minval",0.0f); 01591 float newval = params.set_default("newval",minval); 01592 01593 size_t size = (size_t)image->get_xsize() * 01594 (size_t)image->get_ysize() * 01595 (size_t)image->get_zsize(); 01596 float *data = image->get_data(); 01597 01598 01599 01600 for (size_t i = 0; i < size; ++i) { 01601 if (data[i]<minval) data[i]=newval; 01602 } 01603 image->update(); 01604 }
const string ToMinvalProcessor::NAME = "threshold.belowtominval" [static] |