#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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "xform.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 1565 of file processor.h.
|
Check that the particular aspect is valid.
Definition at line 8656 of file processor.cpp. References InvalidParameterException. Referenced by process(), and process_inplace(). 08656 { 08657 if (translation.size() == 0 ) throw InvalidParameterException("You must specify the trans argument"); 08658 }
|
|
Get the clip region that will achieve the desired translation.
Definition at line 8660 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(). 08660 { 08661 unsigned int dim = static_cast<unsigned int> (image->get_ndim()); 08662 08663 if ( translation.size() != dim ) { 08664 for(unsigned int i = translation.size(); i < dim; ++i ) translation.push_back(0); 08665 } 08666 08667 Region clip_region; 08668 if (dim == 1) { 08669 clip_region = Region(-translation[0],image->get_xsize()); 08670 } else if ( dim == 2 ) { 08671 clip_region = Region(-translation[0],-translation[1],image->get_xsize(),image->get_ysize()); 08672 } else if ( dim == 3 ) { 08673 clip_region = Region(-translation[0],-translation[1],-translation[2],image->get_xsize(),image->get_ysize(),image->get_zsize()); 08674 } else throw ImageDimensionException("Only 1,2 and 3D images are supported"); 08675 08676 return clip_region; 08677 }
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 1597 of file processor.h. 01598 { 01599 return "The image is translated an integer amount"; 01600 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 1568 of file processor.h. 01569 {
01570 return NAME;
01571 }
|
|
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 1590 of file processor.h. References EMAN::TypeDict::put(). 01591 { 01592 TypeDict d; 01593 d.put("trans", EMObject::INTARRAY, "The displacement array, can be length 1-3" ); 01594 return d; 01595 }
|
|
Definition at line 1573 of file processor.h. 01574 { 01575 return new IntTranslateProcessor(); 01576 }
|
|
Reimplemented from EMAN::Processor. Definition at line 8692 of file processor.cpp. References assert_valid_aspect(), EMAN::EMData::get_clip(), get_clip_region(), and EMAN::Dict::set_default(). 08692 { 08693 08694 vector<int> translation = params.set_default("trans",vector<int>() ); 08695 08696 assert_valid_aspect(translation,image); 08697 08698 Region clip_region = get_clip_region(translation,image); 08699 08700 return image->get_clip(clip_region,0); 08701 // clip_inplace does the update! 08702 }
|
|
Implements EMAN::Processor. Definition at line 8679 of file processor.cpp. References assert_valid_aspect(), EMAN::EMData::clip_inplace(), get_clip_region(), and EMAN::Dict::set_default(). 08679 { 08680 08681 vector<int> translation = params.set_default("trans",vector<int>() ); 08682 08683 08684 assert_valid_aspect(translation,image); 08685 08686 Region clip_region = get_clip_region(translation,image); 08687 08688 image->clip_inplace(clip_region,0); 08689 // clip_inplace does the update! 08690 }
|
|
Definition at line 87 of file processor.cpp. |