EMAN::ToMinvalProcessor Class Reference

f(x) = x if x >= minval; f(x) = minval if x < minval More...

#include <processor.h>

Inheritance diagram for EMAN::ToMinvalProcessor:

Inheritance graph
[legend]
Collaboration diagram for EMAN::ToMinvalProcessor:

Collaboration graph
[legend]
List of all members.

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 ProcessorNEW ()

Static Public Attributes

static const string NAME = "threshold.belowtominval"

Detailed Description

f(x) = x if x >= minval; f(x) = minval if x < minval

Parameters:
minval Everything below this value is set to this value

Definition at line 1739 of file processor.h.


Member Function Documentation

string EMAN::ToMinvalProcessor::get_desc (  )  const [inline, virtual]

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 1761 of file processor.h.

01762                 {
01763                         return "f(x) = x if x >= minval; f(x) = minval|newval if x < minval.";
01764                 }

string EMAN::ToMinvalProcessor::get_name (  )  const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 1742 of file processor.h.

References NAME.

01743                 {
01744                         return NAME;
01745                 }

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.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 1753 of file processor.h.

References EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().

01754                 {
01755                         TypeDict d;
01756                         d.put("minval", EMObject::FLOAT, "Everything below this value is set to this value");
01757                         d.put("newval", EMObject::FLOAT, "If set, values below minval will be set to newval instead of minval ");
01758                         return d;
01759                 }

static Processor* EMAN::ToMinvalProcessor::NEW (  )  [inline, static]

Definition at line 1746 of file processor.h.

01747                 {
01748                         return new ToMinvalProcessor();
01749                 }

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 1495 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().

01496 {
01497         if (!image) {
01498                 LOGWARN("NULL Image");
01499                 return;
01500         }
01501 
01502         float minval = params.set_default("minval",0.0f);
01503         float newval = params.set_default("newval",minval);
01504 
01505         size_t size = (size_t)image->get_xsize() *
01506                           (size_t)image->get_ysize() *
01507                           (size_t)image->get_zsize();
01508         float *data = image->get_data();
01509 
01510 
01511 
01512         for (size_t i = 0; i < size; i++) {
01513                 if (data[i]<minval) data[i]=newval;
01514         }
01515         image->update();
01516 }


Member Data Documentation

const string ToMinvalProcessor::NAME = "threshold.belowtominval" [static]

Definition at line 1766 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:16:38 2010 for EMAN2 by  doxygen 1.4.7