#include <processor_template.h>
Inheritance diagram for EMAN::XYZProcessor:
Public Member Functions | |
void | process_inplace (EMData *image) |
define your Processor operation | |
string | get_name () const |
Get the processor's name. | |
string | get_desc () const |
Get the descrition of this specific processor. | |
TypeDict | get_param_types () const |
Add your processor parameter names and types in get_param_types(). | |
Static Public Member Functions | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "xyz" |
Please add your own code at the proper place.
1) Replace all 'XYZ' with your new processor name. 2) Define the processor parameter names and types in get_param_types(). 3) Implement the processor in XYZProcessor::process_inplace().
Definition at line 48 of file processor_template.h.
string EMAN::XYZProcessor::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 63 of file processor_template.h.
string EMAN::XYZProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 53 of file processor_template.h.
References NAME.
00054 { 00055 return NAME; 00056 }
TypeDict EMAN::XYZProcessor::get_param_types | ( | ) | const [inline, virtual] |
Add your processor parameter names and types in get_param_types().
For available parameter types, please refer class EMObject.
As an example, XYZProcessor has 2 parameters: int value1; float value2;
Reimplemented from EMAN::Processor.
Definition at line 76 of file processor_template.h.
References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().
00077 { 00078 TypeDict d; 00079 d.put("value1", EMObject::INT); 00080 d.put("value2", EMObject::FLOAT); 00081 return d; 00082 }
static Processor* EMAN::XYZProcessor::NEW | ( | ) | [inline, static] |
void XYZProcessor::process_inplace | ( | EMData * | image | ) | [virtual] |
define your Processor operation
Implements EMAN::Processor.
Definition at line 41 of file processor_template.cpp.
References data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), and EMAN::Processor::params.
00042 { 00043 if (!image) { 00044 return; 00045 } 00046 00047 00048 // The following are the sample code to get your parameters. Then 00049 // go through the image data pixel. 00050 #if 0 00051 int value1 = params["value1"]; 00052 float value2 = params["value2"]; 00053 00054 float *data = image->get_data(); 00055 int size = image->get_xsize() * image->get_ysize() * image->get_zsize(); 00056 for (int i = 0; i < size; i++) { 00057 if (data[i] <= value1 && data[i] >= value2) { 00058 data[i] = 0; 00059 } 00060 } 00061 #endif 00062 00063 }
const string XYZProcessor::NAME = "xyz" [static] |