#include <processor.h>
Inheritance diagram for EMAN::DirectionalSumProcessor:
Public Member Functions | ||||
virtual string | get_name () const | |||
Get the processor's name. | ||||
virtual EMData * | process (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 | ||||
static Processor * | NEW () | |||
Static Public Attributes | ||||
static const string | NAME = "misc.directional_sum" |
direction | The direction of the sum, either x,y or z |
Definition at line 5479 of file processor.h.
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 5511 of file processor.h. 05512 { 05513 return "Calculates the projection of the image along one of the axial directions, either x, y or z"; 05514 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5482 of file processor.h. References NAME. 05483 { 05484 return NAME; 05485 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 5504 of file processor.h. References EMAN::TypeDict::put(), and EMAN::EMObject::STRING. 05505 { 05506 TypeDict d; 05507 d.put("direction", EMObject::STRING,"The direction of the sum, either x,y or z"); 05508 return d; 05509 }
|
|
Definition at line 5487 of file processor.h. 05488 { 05489 return new DirectionalSumProcessor(); 05490 }
|
|
Reimplemented from EMAN::Processor. Definition at line 6668 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. 06668 { 06669 string dir = params.set_default("direction", ""); 06670 if ( dir == "" || ( dir != "x" && dir != "y" && dir != "z" ) ) 06671 throw InvalidParameterException("The direction parameter must be either x, y, or z"); 06672 06673 int nx = image->get_xsize(); 06674 int ny = image->get_ysize(); 06675 int nz = image->get_zsize(); 06676 06677 // compress one of the dimensions 06678 if ( dir == "x" ) nx = 1; 06679 else if ( dir == "y" ) ny = 1; 06680 else if ( dir == "z" ) nz = 1; 06681 06682 EMData* ret = new EMData; 06683 ret->set_size(nx,ny,nz); 06684 ret->to_zero(); 06685 06686 float* d = image->get_data(); 06687 for(int k = 0; k < image->get_zsize(); ++k ) { 06688 for(int j = 0; j < image->get_ysize(); ++j ) { 06689 for(int i = 0; i < image->get_xsize(); ++i, ++d ) { 06690 if ( dir == "x" ) { 06691 float v = ret->get_value_at(0,j,k); 06692 ret->set_value_at(0,j,k,*d+v); 06693 }else if ( dir == "y" ) { 06694 float v = ret->get_value_at(i,0,k); 06695 ret->set_value_at(i,0,k,*d+v); 06696 } 06697 else if ( dir == "z" ) { 06698 float v = ret->get_value_at(i,j,0); 06699 ret->set_value_at(i,j,0,*d+v); 06700 } 06701 } 06702 } 06703 } 06704 ret->update(); 06705 return ret; 06706 }
|
|
Implements EMAN::Processor. Definition at line 5500 of file processor.h. References InvalidCallException. 05500 { 05501 throw InvalidCallException("The directional sum processor does not work inplace"); 05502 }
|
|
Definition at line 5516 of file processor.h. Referenced by get_name(). |