EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all members
EMAN::IntTranslateProcessor Class Reference

Translate the image an integer amount Uses EMData::clip_inplace (inplace) and EMData::get_clip (out of place) to do the translation. More...

#include <processor.h>

Inheritance diagram for EMAN::IntTranslateProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::IntTranslateProcessor:
Collaboration graph
[legend]

Public Member Functions

virtual string get_name () const
 Get the processor's name. More...
 
virtual void process_inplace (EMData *image)
 
virtual EMDataprocess (const EMData *const image)
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Static Public Attributes

static 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. More...
 
Region get_clip_region (vector< int > &translation, const EMData *const image) const
 Get the clip region that will achieve the desired translation. More...
 

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Translate the image an integer amount Uses EMData::clip_inplace (inplace) and EMData::get_clip (out of place) to do the translation.

Author
David Woolford
Date
March 2009
Parameters
transThe displacement array, can be length 1-3

Definition at line 2887 of file processor.h.

Member Function Documentation

◆ assert_valid_aspect()

void IntTranslateProcessor::assert_valid_aspect ( const vector< int > &  translation,
const EMData *const  image 
) const
private

Check that the particular aspect is valid.

Exceptions
ImageDimensionExceptionif the image is not 1,2 or 3D

Definition at line 11764 of file processor.cpp.

11764 {
11765 if (translation.size() == 0 ) throw InvalidParameterException("You must specify the trans argument");
11766}
#define InvalidParameterException(desc)
Definition: exception.h:361

References InvalidParameterException.

Referenced by process(), and process_inplace().

◆ get_clip_region()

Region IntTranslateProcessor::get_clip_region ( vector< int > &  translation,
const EMData *const  image 
) const
private

Get the clip region that will achieve the desired translation.

Exceptions
ImageDimensionExceptionif the image is not 1,2 or 3D
Parameters
translationthe amount by which to translate
imagethe image that will eventually used for the translation operation

Definition at line 11768 of file processor.cpp.

11768 {
11769 unsigned int dim = static_cast<unsigned int> (image->get_ndim());
11770
11771 if ( translation.size() != dim ) {
11772 for(unsigned int i = translation.size(); i < dim; ++i ) translation.push_back(0);
11773 }
11774
11775 Region clip_region;
11776 if (dim == 1) {
11777 clip_region = Region(-translation[0],image->get_xsize());
11778 } else if ( dim == 2 ) {
11779 clip_region = Region(-translation[0],-translation[1],image->get_xsize(),image->get_ysize());
11780 } else if ( dim == 3 ) {
11781 clip_region = Region(-translation[0],-translation[1],-translation[2],image->get_xsize(),image->get_ysize(),image->get_zsize());
11782 } else throw ImageDimensionException("Only 1,2 and 3D images are supported");
11783
11784 return clip_region;
11785}
Region defines a 2D or 3D rectangular region specified by its origin coordinates and all edges' sizes...
Definition: geometry.h:497
#define ImageDimensionException(desc)
Definition: exception.h:166

References ImageDimensionException.

Referenced by process(), and process_inplace().

◆ get_desc()

virtual string EMAN::IntTranslateProcessor::get_desc ( ) const
inlinevirtual

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

2920 {
2921 return "The image is translated an integer amount";
2922 }

◆ get_name()

virtual string EMAN::IntTranslateProcessor::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 2890 of file processor.h.

2891 {
2892 return NAME;
2893 }
static const string NAME
Definition: processor.h:2924

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::IntTranslateProcessor::get_param_types ( ) const
inlinevirtual

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

2913 {
2914 TypeDict d;
2915 d.put("trans", EMObject::INTARRAY, "The displacement array, can be length 1-3" );
2916 return d;
2917 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

References EMAN::EMObject::INTARRAY, and EMAN::TypeDict::put().

◆ NEW()

static Processor * EMAN::IntTranslateProcessor::NEW ( )
inlinestatic

Definition at line 2895 of file processor.h.

2896 {
2897 return new IntTranslateProcessor();
2898 }
Translate the image an integer amount Uses EMData::clip_inplace (inplace) and EMData::get_clip (out o...
Definition: processor.h:2888

◆ process()

EMData * IntTranslateProcessor::process ( const EMData *const  image)
virtual
Exceptions
ImageDimensionExceptionif the image is not 1,2 or 3D
InvalidParameterExceptionif the Transform parameter is not specified

Reimplemented from EMAN::Processor.

Definition at line 11800 of file processor.cpp.

11800 {
11801
11802 vector<int> translation = params.set_default("trans",vector<int>() );
11803
11804 assert_valid_aspect(translation,image);
11805
11806 Region clip_region = get_clip_region(translation,image);
11807
11808 return image->get_clip(clip_region,0);
11809 // clip_inplace does the update!
11810}
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
EMData * get_clip(const Region &area, const float fill=0) const
Get an inclusive clip.
Definition: emdata.cpp:592
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.

References assert_valid_aspect(), EMAN::EMData::get_clip(), get_clip_region(), EMAN::Processor::params, and EMAN::Dict::set_default().

◆ process_inplace()

void IntTranslateProcessor::process_inplace ( EMData image)
virtual
Exceptions
ImageDimensionExceptionif the image is not 1,2 or 3D
InvalidParameterExceptionif the Transform parameter is not specified

Implements EMAN::Processor.

Definition at line 11787 of file processor.cpp.

11787 {
11788
11789 vector<int> translation = params.set_default("trans",vector<int>() );
11790
11791
11792 assert_valid_aspect(translation,image);
11793
11794 Region clip_region = get_clip_region(translation,image);
11795
11796 image->clip_inplace(clip_region,0);
11797 // clip_inplace does the update!
11798}
void clip_inplace(const Region &area, const float &fill_value=0)
Clip the image inplace - clipping region must be smaller than the current region internally memory is...
Definition: emdata.cpp:350

References assert_valid_aspect(), EMAN::EMData::clip_inplace(), get_clip_region(), EMAN::Processor::params, and EMAN::Dict::set_default().

Member Data Documentation

◆ NAME

const string IntTranslateProcessor::NAME = "xform.translate.int"
static

Definition at line 2924 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: