Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::DirectionalSumProcessor Class Reference

Does a projection in one the axial directions Doesn't support process_inplace (because the output has potentially been compressed in one dimension). More...

#include <processor.h>

Inheritance diagram for EMAN::DirectionalSumProcessor:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual string get_name () const
 Get the processor's name.
virtual EMDataprocess (const EMData *const image)
 
Exceptions:
InvalidParameterException raised if the direction parameter is not "x", "y" or "z"

virtual void process_inplace (EMData *image)
 
Exceptions:
InvalidCallException raised if this function is called

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

Static Public Attributes

static const string NAME = "misc.directional_sum"

Detailed Description

Does a projection in one the axial directions Doesn't support process_inplace (because the output has potentially been compressed in one dimension).

Parameters:
direction The direction of the sum, either x,y or z

Definition at line 5439 of file processor.h.


Member Function Documentation

string EMAN::DirectionalSumProcessor::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 5471 of file processor.h.

05472                 {
05473                         return "Calculates the projection of the image along one of the axial directions, either x, y or z";
05474                 }

virtual string EMAN::DirectionalSumProcessor::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 5442 of file processor.h.

References NAME.

05443                 {
05444                         return NAME;
05445                 }

virtual TypeDict EMAN::DirectionalSumProcessor::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 5464 of file processor.h.

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

05465                 {
05466                         TypeDict d;
05467                         d.put("direction", EMObject::STRING,"The direction of the sum, either x,y or z");
05468                         return d;
05469                 }

static Processor* EMAN::DirectionalSumProcessor::NEW  )  [inline, static]
 

Definition at line 5447 of file processor.h.

05448                 {
05449                         return new DirectionalSumProcessor();
05450                 }

EMData * DirectionalSumProcessor::process const EMData *const   image  )  [virtual]
 

Exceptions:
InvalidParameterException raised if the direction parameter is not "x", "y" or "z"

Reimplemented from EMAN::Processor.

Definition at line 6561 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_value_at(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), InvalidParameterException, EMAN::Processor::params, EMAN::Dict::set_default(), EMAN::EMData::set_size(), EMAN::EMData::set_value_at(), EMAN::EMData::to_zero(), EMAN::EMData::update(), and v.

06561                                                                    {
06562         string dir = params.set_default("direction", "");
06563         if ( dir == "" || ( dir != "x" && dir != "y" && dir != "z" ) )
06564                 throw InvalidParameterException("The direction parameter must be either x, y, or z");
06565 
06566         int nx = image->get_xsize();
06567         int ny = image->get_ysize();
06568         int nz = image->get_zsize();
06569 
06570         // compress one of the dimensions
06571         if ( dir == "x" ) nx = 1;
06572         else if ( dir == "y" ) ny = 1;
06573         else if ( dir == "z" ) nz = 1;
06574 
06575         EMData* ret = new EMData;
06576         ret->set_size(nx,ny,nz);
06577         ret->to_zero();
06578 
06579         float* d = image->get_data();
06580         for(int k = 0; k < image->get_zsize(); ++k ) {
06581                 for(int j = 0; j < image->get_ysize(); ++j ) {
06582                         for(int i = 0; i < image->get_xsize(); ++i, ++d ) {
06583                                 if ( dir == "x" ) {
06584                                         float v = ret->get_value_at(0,j,k);
06585                                         ret->set_value_at(0,j,k,*d+v);
06586                                 }else if ( dir == "y" ) {
06587                                         float v = ret->get_value_at(i,0,k);
06588                                         ret->set_value_at(i,0,k,*d+v);
06589                                 }
06590                                 else if ( dir == "z" ) {
06591                                         float v = ret->get_value_at(i,j,0);
06592                                         ret->set_value_at(i,j,0,*d+v);
06593                                 }
06594                         }
06595                 }
06596         }
06597         ret->update();
06598         return ret;
06599 }

virtual void EMAN::DirectionalSumProcessor::process_inplace EMData image  )  [inline, virtual]
 

Exceptions:
InvalidCallException raised if this function is called

Implements EMAN::Processor.

Definition at line 5460 of file processor.h.

References InvalidCallException.

05460                                                              {
05461                         throw InvalidCallException("The directional sum processor does not work inplace");
05462                 }


Member Data Documentation

const string DirectionalSumProcessor::NAME = "misc.directional_sum" [static]
 

Definition at line 5476 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:37:40 2010 for EMAN2 by  doxygen 1.4.4