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

ToMassCenterProcessor centers image at center of mass, ignores old dx, dy. More...

#include <processor.h>

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

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
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.phasecenterofmass"
 

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

ToMassCenterProcessor centers image at center of mass, ignores old dx, dy.

Parameters
int_shift_onlyset to 1 only shift by integer, no interpolation

Definition at line 7057 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::PhaseToMassCenterProcessor::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 7072 of file processor.h.

7073 {
7074 return "centers the image the center of mass, which is calculated using Fourier phases, ignores old dx, dy.";
7075 }

◆ get_name()

virtual string EMAN::PhaseToMassCenterProcessor::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 7062 of file processor.h.

7063 {
7064 return NAME;
7065 }
static const string NAME
Definition: processor.h:7084

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::PhaseToMassCenterProcessor::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 7077 of file processor.h.

7078 {
7079 TypeDict d;
7080 d.put("int_shift_only", EMObject::INT, "If set, will only shift by integer amounts to avoid interpolation");
7081 return d;
7082 }
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::INT, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 7067 of file processor.h.

7068 {
7069 return new PhaseToMassCenterProcessor();
7070 }
ToMassCenterProcessor centers image at center of mass, ignores old dx, dy.
Definition: processor.h:7058

◆ process_inplace()

void PhaseToMassCenterProcessor::process_inplace ( EMData image)
virtual

To process an image in-place.

For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.

Parameters
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 7498 of file processor.cpp.

7499{
7500 if (!image) {
7501 LOGWARN("NULL Image");
7502 return;
7503 }
7504
7505 int int_shift_only = params.set_default("int_shift_only",1);
7506
7507 vector<float> pcog = image->phase_cog();
7508
7509 int dims = image->get_ndim();
7510
7511 if (int_shift_only) {
7512 int dx=-int(pcog[0]+0.5f),dy=0,dz=0;
7513 if ( dims >= 2 ) dy = -int(pcog[1]+0.5);
7514 if ( dims == 3 ) dz = -int(pcog[2]+0.5);
7515
7516 Transform t;
7517 t.set_trans((float)dx,(float)dy,(float)dz);
7518 if (dims == 3) image->set_attr("xform.align3d",&t);
7519 else if (dims == 2) image->set_attr("xform.align2d",&t);
7520
7521 image->translate(dx,dy,dz);
7522 } else {
7523 float dx=-pcog[0],dy=0.0,dz=0.0;
7524 if ( dims >= 2 ) dy = -pcog[1];
7525 if ( dims == 3 ) dz = -pcog[2];
7526 image->translate(dx,dy,dz);
7527
7528 Transform t;
7529 t.set_trans(dx,dy,dz);
7530 if (dims == 3) image->set_attr("xform.align3d",&t);
7531 else if (dims == 2) image->set_attr("xform.align2d",&t);
7532 }
7533}
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
void translate(float dx, float dy, float dz)
Translate this image.
Definition: emdata.cpp:904
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
void set_trans(const float &x, const float &y, const float &z=0)
Set the post translation component.
Definition: transform.cpp:1036
#define LOGWARN
Definition: log.h:53

References LOGWARN, EMAN::Processor::params, EMAN::Dict::set_default(), EMAN::Transform::set_trans(), and EMAN::EMData::translate().

Member Data Documentation

◆ NAME

const string PhaseToMassCenterProcessor::NAME = "xform.phasecenterofmass"
static

Definition at line 7084 of file processor.h.

Referenced by get_name().


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