Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

ProcessorNEW ()

Static Public Attributes

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 1710 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 1732 of file processor.h.

01733                 {
01734                         return "f(x) = x if x >= minval; f(x) = minval|newval if x < minval.";
01735                 }

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 1713 of file processor.h.

01714                 {
01715                         return NAME;
01716                 }

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 1724 of file processor.h.

References EMAN::TypeDict::put().

01725                 {
01726                         TypeDict d;
01727                         d.put("minval", EMObject::FLOAT, "Everything below this value is set to this value");
01728                         d.put("newval", EMObject::FLOAT, "If set, values below minval will be set to newval instead of minval ");
01729                         return d;
01730                 }

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

Definition at line 1717 of file processor.h.

01718                 {
01719                         return new ToMinvalProcessor();
01720                 }

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 1542 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().

01543 {
01544         if (!image) {
01545                 LOGWARN("NULL Image");
01546                 return;
01547         }
01548 
01549         float minval = params.set_default("minval",0.0f);
01550         float newval = params.set_default("newval",minval);
01551 
01552         size_t size = (size_t)image->get_xsize() *
01553                           (size_t)image->get_ysize() *
01554                           (size_t)image->get_zsize();
01555         float *data = image->get_data();
01556 
01557 
01558 
01559         for (size_t i = 0; i < size; ++i) {
01560                 if (data[i]<minval) data[i]=newval;
01561         }
01562         image->update();
01563 }


Member Data Documentation

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

Definition at line 92 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:30:04 2011 for EMAN2 by  doxygen 1.3.9.1