#include <processor.h>
Inheritance diagram for EMAN::ClampingProcessor:
Public Member Functions | |
ClampingProcessor () | |
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.clampminmax" |
Protected Attributes | |
float | default_max |
float | default_min |
minval | the minimum value to clamp to | |
maxval | the maximum value to clamp to Replace outlying pixels values with the mean pixel value instead |
Definition at line 1659 of file processor.h.
|
Definition at line 1662 of file processor.h. Referenced by NEW(). 01662 : default_max(1.0), default_min(0.0) {}
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Reimplemented in EMAN::NSigmaClampingProcessor. Definition at line 1684 of file processor.h. 01685 { 01686 return "This function clamps the min and max vals in the image at minval and maxval, respectively. In a sense this a bi-truncation of the data."; 01687 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Reimplemented in EMAN::NSigmaClampingProcessor. Definition at line 1664 of file processor.h. References NAME. 01665 { 01666 return NAME; 01667 }
|
|
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. Reimplemented in EMAN::NSigmaClampingProcessor. Definition at line 1675 of file processor.h. References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, and EMAN::TypeDict::put(). 01676 { 01677 TypeDict d; 01678 d.put("minval", EMObject::FLOAT, "The pixel values that bounds the smallest pixel value in the output image" ); 01679 d.put("maxval", EMObject::FLOAT, "The pixel values that bounds the largest pixel value in the output image" ); 01680 d.put("tomean", EMObject::BOOL, "Replace outlying pixels values with the mean pixel value instead" ); 01681 return d; 01682 }
|
|
Reimplemented in EMAN::NSigmaClampingProcessor. Definition at line 1668 of file processor.h. References ClampingProcessor(). 01669 { 01670 return new ClampingProcessor(); 01671 }
|
|
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. Reimplemented in EMAN::NSigmaClampingProcessor. Definition at line 8647 of file processor.cpp. References default_max, default_min, EMAN::EMData::get_attr(), EMAN::EMData::get_data(), EMAN::EMData::get_size(), ImageFormatException, InvalidParameterException, EMAN::EMData::is_complex(), max, min, EMAN::Processor::params, EMAN::Dict::set_default(), and EMAN::EMData::update(). 08648 { 08649 08650 if ( image->is_complex() ) throw ImageFormatException("Error: clamping processor does not work on complex images"); 08651 08652 float min = params.set_default("minval",default_min); 08653 float max = params.set_default("maxval",default_max); 08654 bool tomean = params.set_default("tomean",false); 08655 float new_min_vals = min; 08656 float new_max_vals = max; 08657 if (tomean){ 08658 08659 new_min_vals = image->get_attr("mean"); 08660 new_max_vals = image->get_attr("mean"); 08661 } 08662 08663 // Okay, throwing such an error is probably overkill - but atleast the user will get a loud message 08664 // saying what went wrong. 08665 if ( max < min ) throw InvalidParameterException("Error: minval was greater than maxval, aborting"); 08666 08667 size_t size = image->get_size(); 08668 for(size_t i = 0; i < size; ++i ) 08669 { 08670 float * data = &image->get_data()[i]; 08671 if ( *data < min ) *data = new_min_vals; 08672 else if ( *data > max ) *data = new_max_vals; 08673 } 08674 image->update(); 08675 }
|
|
Definition at line 1692 of file processor.h. Referenced by process_inplace(). |
|
Definition at line 1692 of file processor.h. Referenced by process_inplace(). |
|
Reimplemented in EMAN::NSigmaClampingProcessor. Definition at line 1689 of file processor.h. Referenced by get_name(). |