EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::XYZProcessor Class Reference

XYZProcessor is a processor template for defining new processors. More...

#include <processor_template.h>

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

List of all members.

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

Static Public Attributes

static const string NAME = "xyz"

Detailed Description

XYZProcessor is a processor template for defining new processors.

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.


Member Function Documentation

string EMAN::XYZProcessor::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 63 of file processor_template.h.

                {
                        return "add your documentation here.";
                }
string EMAN::XYZProcessor::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 53 of file processor_template.h.

References NAME.

                {
                        return NAME;
                }
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().

                {
                        TypeDict d;
                        d.put("value1", EMObject::INT);
                        d.put("value2", EMObject::FLOAT);
                        return d;
                }
static Processor* EMAN::XYZProcessor::NEW ( ) [inline, static]

Definition at line 58 of file processor_template.h.

                {
                        return new XYZProcessor();
                }
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.

{
        if (!image) {
                return;
        }


        // The following are the sample code to get your parameters. Then
        // go through the image data pixel.
#if 0
        int value1 = params["value1"];
        float value2 = params["value2"];

        float *data = image->get_data();
        int size = image->get_xsize() * image->get_ysize() * image->get_zsize();
        for (int i = 0; i < size; i++) {
                if (data[i] <= value1 && data[i] >= value2) {
                        data[i] = 0;
                }
        }
#endif

}

Member Data Documentation

const string XYZProcessor::NAME = "xyz" [static]

Definition at line 84 of file processor_template.h.

Referenced by get_name().


The documentation for this class was generated from the following files: