EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
EMAN::BinaryOperateProcessor< Type > Class Template Reference

Operates on two images, returning an image containing the maximum/minimum/multiplied pixel (etc, you choose) at each location The actual operation depends on what template argument you use. More...

#include <processor.h>

Inheritance diagram for EMAN::BinaryOperateProcessor< Type >:
Inheritance graph
[legend]
Collaboration diagram for EMAN::BinaryOperateProcessor< Type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void process_inplace (EMData *image)
 
Exceptions:
InvalidParameterExceptionif with is not specified
ImageDimensionExceptionif image dimensions do not match

virtual string get_name () const
 Get the processor's name.
virtual string get_desc () const
 Get the descrition of this specific processor.
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME

Private Attributes

Type op

Detailed Description

template<class Type>
class EMAN::BinaryOperateProcessor< Type >

Operates on two images, returning an image containing the maximum/minimum/multiplied pixel (etc, you choose) at each location The actual operation depends on what template argument you use.

Currently the MaxPixelOperator and MinPixelOperator are the only ones utilized - see processor.cpp where the Processor Factory constructor is defined to get an idea of how to add another one Initially added at the request of Dr Matthew Baker NOTE: binary is meant in the sense of the standard algorithms, NOT in the sense of a black and white image

Parameters:
withthe other image that will be used generate the image with the maximum (or minimum, etc) pixel values
Author:
David Woolford
Date:
June 2009

Definition at line 6027 of file processor.h.


Member Function Documentation

template<class Type >
virtual string EMAN::BinaryOperateProcessor< Type >::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 6052 of file processor.h.

References EMAN::BinaryOperateProcessor< Type >::op.

                        {
                                return op.get_desc();
                        }
template<class Type >
virtual string EMAN::BinaryOperateProcessor< Type >::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 6047 of file processor.h.

References EMAN::BinaryOperateProcessor< Type >::op.

                        {
                                return op.get_name();
                        }
template<class Type >
virtual TypeDict EMAN::BinaryOperateProcessor< Type >::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 6062 of file processor.h.

References EMAN::EMObject::EMDATA, and EMAN::TypeDict::put().

                        {
                                TypeDict d;
                                d.put("with", EMObject::EMDATA,"The second image");
                                return d;
                        }
template<class Type >
static Processor* EMAN::BinaryOperateProcessor< Type >::NEW ( ) [inline, static]

Definition at line 6057 of file processor.h.

                        {
                                return new BinaryOperateProcessor<Type>();
                        }
template<class Type >
virtual void EMAN::BinaryOperateProcessor< Type >::process_inplace ( EMData image) [inline, virtual]

Exceptions:
InvalidParameterExceptionif with is not specified
ImageDimensionExceptionif image dimensions do not match

Implements EMAN::Processor.

Definition at line 6033 of file processor.h.

References EMAN::EMData::get_data(), EMAN::EMData::get_size(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Dict::has_key(), ImageDimensionException, InvalidParameterException, EMAN::Processor::params, and EMAN::EMData::update().

                                                                     {
                                if ( ! params.has_key("with") ) throw InvalidParameterException("You must supply the \"with\" parameter");
                                EMData* with = params["with"];

                                if ( with->get_xsize() != image->get_xsize() || with->get_ysize() != image->get_ysize() || with->get_zsize() != image->get_zsize() )
                                        throw ImageDimensionException("The images you are operating on do not have the same dimensions");

                                float* image_data = image->get_data();
                                float* with_data = with->get_data();

                                std::transform(image_data,image_data+image->get_size(),with_data,image_data,Type::binary_operate);
                                image->update();
                        }

Member Data Documentation

template<class Type >
const string EMAN::BinaryOperateProcessor< Type >::NAME [static]

Definition at line 6069 of file processor.h.

template<class Type >
Type EMAN::BinaryOperateProcessor< Type >::op [private]

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