Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::PhaseToMassCenterProcessor Class Reference
[unit test in Python]

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]
List of all members.

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place.
virtual string get_name () const
 Get the processor's name.
virtual string get_desc () const
 Get the descrition of this specific processor.
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "xform.phasecenterofmass"

Detailed Description

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

Parameters:
int_shift_only set to 1 only shift by integer, no interpolation

Definition at line 5054 of file processor.h.


Member Function Documentation

virtual string EMAN::PhaseToMassCenterProcessor::get_desc  )  const [inline, virtual]
 

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

05070                         {
05071                                 return "centers the image the center of mass, which is calculated using Fourier phases, ignores old dx, dy.";
05072                         }

virtual string EMAN::PhaseToMassCenterProcessor::get_name  )  const [inline, virtual]
 

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 5059 of file processor.h.

05060                         {
05061                                 return NAME;
05062                         }

virtual TypeDict EMAN::PhaseToMassCenterProcessor::get_param_types  )  const [inline, virtual]
 

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

References EMAN::TypeDict::put().

05075                         {
05076                                 TypeDict d;
05077                                 d.put("int_shift_only", EMObject::INT, "set to 1 only shift by integer, no interpolation");
05078                                 return d;
05079                         }

Processor* EMAN::PhaseToMassCenterProcessor::NEW  )  [inline, static]
 

Definition at line 5064 of file processor.h.

05065                         {
05066                                 return new PhaseToMassCenterProcessor();
05067                         }

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:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 5633 of file processor.cpp.

References EMAN::EMData::get_ndim(), LOGWARN, EMAN::EMData::phase_cog(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), EMAN::Transform::set_trans(), t, and EMAN::EMData::translate().

05634 {
05635         if (!image) {
05636                 LOGWARN("NULL Image");
05637                 return;
05638         }
05639 
05640         int int_shift_only = params.set_default("int_shift_only",1);
05641 
05642         vector<float> pcog = image->phase_cog();
05643 
05644         int dims = image->get_ndim();
05645 
05646         if (int_shift_only) {
05647                 int dx=-int(pcog[0]+0.5f),dy=0,dz=0;
05648                 if ( dims >= 2 ) dy = -int(pcog[1]+0.5);
05649                 if ( dims == 3 ) dz = -int(pcog[2]+0.5);
05650 
05651                 Transform t;
05652                 t.set_trans((float)dx,(float)dy,(float)dz);
05653                 if (dims == 3) image->set_attr("xform.align3d",&t);
05654                 else if (dims == 2) image->set_attr("xform.align2d",&t);
05655 
05656                 image->translate(dx,dy,dz);
05657         } else  {
05658                 float dx=-pcog[0],dy=0.0,dz=0.0;
05659                 if ( dims >= 2 ) dy = -pcog[1];
05660                 if ( dims == 3 ) dz = -pcog[2];
05661                 image->translate(dx,dy,dz);
05662 
05663                 Transform t;
05664                 t.set_trans(dx,dy,dz);
05665                 if (dims == 3) image->set_attr("xform.align3d",&t);
05666                 else if (dims == 2) image->set_attr("xform.align2d",&t);
05667         }
05668 }


Member Data Documentation

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

Definition at line 176 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:52:27 2011 for EMAN2 by  doxygen 1.3.9.1