#include <processor.h>
Inheritance diagram for EMAN::IntTranslateProcessor:
Public Member Functions | |||||||
virtual string | get_name () const | ||||||
Get the processor's name. | |||||||
virtual void | process_inplace (EMData *image) | ||||||
| |||||||
virtual EMData * | process (const EMData *const image) | ||||||
| |||||||
virtual TypeDict | get_param_types () const | ||||||
Get processor parameter information in a dictionary. | |||||||
virtual 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 = "math.translate.int" | ||||||
Private Member Functions | |||||||
void | assert_valid_aspect (const vector< int > &translation, const EMData *const image) const | ||||||
Check that the particular aspect is valid
| |||||||
Region | get_clip_region (vector< int > &translation, const EMData *const image) const | ||||||
Get the clip region that will achieve the desired translation
|
trans | The displacement array, can be length 1-3 |
Definition at line 1592 of file processor.h.
|
Check that the particular aspect is valid
Definition at line 8510 of file processor.cpp. References InvalidParameterException. Referenced by process(), and process_inplace(). 08510 { 08511 if (translation.size() == 0 ) throw InvalidParameterException("You must specify the trans argument"); 08512 }
|
|
Get the clip region that will achieve the desired translation
Definition at line 8514 of file processor.cpp. References EMAN::EMData::get_ndim(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), and ImageDimensionException. Referenced by process(), and process_inplace(). 08514 { 08515 unsigned int dim = static_cast<unsigned int> (image->get_ndim()); 08516 08517 if ( translation.size() != dim ) { 08518 for(unsigned int i = translation.size(); i < dim; ++i ) translation.push_back(0); 08519 } 08520 08521 Region clip_region; 08522 if (dim == 1) { 08523 clip_region = Region(-translation[0],image->get_xsize()); 08524 } else if ( dim == 2 ) { 08525 clip_region = Region(-translation[0],-translation[1],image->get_xsize(),image->get_ysize()); 08526 } else if ( dim == 3 ) { 08527 clip_region = Region(-translation[0],-translation[1],-translation[2],image->get_xsize(),image->get_ysize(),image->get_zsize()); 08528 } else throw ImageDimensionException("Only 1,2 and 3D images are supported"); 08529 08530 return clip_region; 08531 }
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 1624 of file processor.h.
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 1595 of file processor.h. References NAME. 01596 { 01597 return NAME; 01598 }
|
|
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 1617 of file processor.h. References EMAN::EMObject::INTARRAY, and EMAN::TypeDict::put(). 01618 { 01619 TypeDict d; 01620 d.put("trans", EMObject::INTARRAY, "The displacement array, can be length 1-3" ); 01621 return d; 01622 }
|
|
Definition at line 1600 of file processor.h. 01601 { 01602 return new IntTranslateProcessor(); 01603 }
|
|
Reimplemented from EMAN::Processor. Definition at line 8546 of file processor.cpp. References assert_valid_aspect(), EMAN::EMData::get_clip(), get_clip_region(), EMAN::Processor::params, and EMAN::Dict::set_default(). 08546 { 08547 08548 vector<int> translation = params.set_default("trans",vector<int>() ); 08549 08550 assert_valid_aspect(translation,image); 08551 08552 Region clip_region = get_clip_region(translation,image); 08553 08554 return image->get_clip(clip_region,0); 08555 // clip_inplace does the update! 08556 }
|
|
Implements EMAN::Processor. Definition at line 8533 of file processor.cpp. References assert_valid_aspect(), EMAN::EMData::clip_inplace(), get_clip_region(), EMAN::Processor::params, and EMAN::Dict::set_default(). 08533 { 08534 08535 vector<int> translation = params.set_default("trans",vector<int>() ); 08536 08537 08538 assert_valid_aspect(translation,image); 08539 08540 Region clip_region = get_clip_region(translation,image); 08541 08542 image->clip_inplace(clip_region,0); 08543 // clip_inplace does the update! 08544 }
|
|
Definition at line 1629 of file processor.h. Referenced by get_name(). |