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:

[legend]
Collaboration diagram for EMAN::DirectionalSumProcessor:
[legend]
List of all members.

Public Member Functions

virtual string get_name () const
 Get the processor's name.
virtual EMDataprocess (const EMData *const image)
virtual void process_inplace (EMData *image)
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

ProcessorNEW ()

Static Public Attributes

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 5438 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 5470 of file processor.h.

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

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 5441 of file processor.h.

05442                 {
05443                         return NAME;
05444                 }

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 5463 of file processor.h.

References EMAN::TypeDict::put().

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

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

Definition at line 5446 of file processor.h.

05447                 {
05448                         return new DirectionalSumProcessor();
05449                 }

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 6530 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, nx, ny, EMAN::Dict::set_default(), EMAN::EMData::set_size(), EMAN::EMData::set_value_at(), EMAN::EMData::to_zero(), EMAN::EMData::update(), and v.

06530                                                                    {
06531         string dir = params.set_default("direction", "");
06532         if ( dir == "" || ( dir != "x" && dir != "y" && dir != "z" ) )
06533                 throw InvalidParameterException("The direction parameter must be either x, y, or z");
06534 
06535         int nx = image->get_xsize();
06536         int ny = image->get_ysize();
06537         int nz = image->get_zsize();
06538 
06539         // compress one of the dimensions
06540         if ( dir == "x" ) nx = 1;
06541         else if ( dir == "y" ) ny = 1;
06542         else if ( dir == "z" ) nz = 1;
06543 
06544         EMData* ret = new EMData;
06545         ret->set_size(nx,ny,nz);
06546         ret->to_zero();
06547 
06548         float* d = image->get_data();
06549         for(int k = 0; k < image->get_zsize(); ++k ) {
06550                 for(int j = 0; j < image->get_ysize(); ++j ) {
06551                         for(int i = 0; i < image->get_xsize(); ++i, ++d ) {
06552                                 if ( dir == "x" ) {
06553                                         float v = ret->get_value_at(0,j,k);
06554                                         ret->set_value_at(0,j,k,*d+v);
06555                                 }else if ( dir == "y" ) {
06556                                         float v = ret->get_value_at(i,0,k);
06557                                         ret->set_value_at(i,0,k,*d+v);
06558                                 }
06559                                 else if ( dir == "z" ) {
06560                                         float v = ret->get_value_at(i,j,0);
06561                                         ret->set_value_at(i,j,0,*d+v);
06562                                 }
06563                         }
06564                 }
06565         }
06566         ret->update();
06567         return ret;
06568 }

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

Exceptions:
InvalidCallException raised if this function is called

Implements EMAN::Processor.

Definition at line 5459 of file processor.h.

References InvalidCallException.

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


Member Data Documentation

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

Definition at line 180 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:27 2010 for EMAN2 by  doxygen 1.3.9.1