#include <processor.h>
Inheritance diagram for EMAN::PeakOnlyProcessor:
Public Member Functions | |
string | get_name () const |
Get the processor's name. | |
void | set_params (const Dict &new_params) |
Set the processor parameters using a key/value dictionary. | |
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 = "mask.onlypeaks" |
Protected Member Functions | |
void | process_pixel (float *pixel, const float *data, int n) const |
Private Attributes | |
int | npeaks |
npeaks | the number of surrounding peaks allow to >= pixel values |
Definition at line 3129 of file processor.h.
string EMAN::PeakOnlyProcessor::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 3156 of file processor.h.
03157 { 03158 return "peak processor -> if npeaks or more surrounding values >= value, value->0"; 03159 }
string EMAN::PeakOnlyProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 3132 of file processor.h.
References NAME.
03133 { 03134 return NAME; 03135 }
TypeDict EMAN::PeakOnlyProcessor::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::BoxStatProcessor.
Definition at line 3149 of file processor.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
03150 { 03151 TypeDict d; 03152 d.put("npeaks", EMObject::INT, "the number of surrounding peaks allow to >= pixel values"); 03153 return d; 03154 }
static Processor* EMAN::PeakOnlyProcessor::NEW | ( | ) | [inline, static] |
void EMAN::PeakOnlyProcessor::process_pixel | ( | float * | pixel, | |
const float * | data, | |||
int | n | |||
) | const [inline, protected, virtual] |
Implements EMAN::BoxStatProcessor.
Definition at line 3164 of file processor.h.
References npeaks.
03165 { 03166 int r = 0; 03167 03168 for (int i = 0; i < n; i++) 03169 { 03170 if (data[i] >= *pixel) { 03171 r++; 03172 } 03173 } 03174 03175 if (r > npeaks) 03176 { 03177 *pixel = 0; 03178 } 03179 }
void EMAN::PeakOnlyProcessor::set_params | ( | const Dict & | new_params | ) | [inline, virtual] |
Set the processor parameters using a key/value dictionary.
new_params | A dictionary containing the new parameters. |
Reimplemented from EMAN::Processor.
Definition at line 3140 of file processor.h.
References npeaks, and EMAN::Processor::params.
03141 { 03142 params = new_params; 03143 npeaks = params["npeaks"]; 03144 if (npeaks == 0) { 03145 npeaks = 1; 03146 } 03147 }
const string PeakOnlyProcessor::NAME = "mask.onlypeaks" [static] |
int EMAN::PeakOnlyProcessor::npeaks [private] |