#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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "misc.directional_sum" |
direction | The direction of the sum, either x,y or z |
Definition at line 5438 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 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 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5441 of file processor.h. 05442 {
05443 return NAME;
05444 }
|
|
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 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 }
|
|
Definition at line 5446 of file processor.h. 05447 { 05448 return new DirectionalSumProcessor(); 05449 }
|
|
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 }
|
|
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 }
|
|
Definition at line 180 of file processor.cpp. |