#include <processor.h>
Inheritance diagram for EMAN::PhaseToMassCenterProcessor:
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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "xform.phasecenterofmass" |
int_shift_only | set to 1 only shift by integer, no interpolation |
Definition at line 5134 of file processor.h.
virtual string EMAN::PhaseToMassCenterProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 5149 of file processor.h.
05150 { 05151 return "centers the image the center of mass, which is calculated using Fourier phases, ignores old dx, dy."; 05152 }
virtual string EMAN::PhaseToMassCenterProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 5139 of file processor.h.
References NAME.
05140 { 05141 return NAME; 05142 }
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.
Reimplemented from EMAN::Processor.
Definition at line 5154 of file processor.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
05155 { 05156 TypeDict d; 05157 d.put("int_shift_only", EMObject::INT, "set to 1 only shift by integer, no interpolation"); 05158 return d; 05159 }
static Processor* EMAN::PhaseToMassCenterProcessor::NEW | ( | ) | [inline, static] |
Definition at line 5144 of file processor.h.
05145 { 05146 return new PhaseToMassCenterProcessor(); 05147 }
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 5807 of file processor.cpp.
References EMAN::EMData::get_ndim(), LOGWARN, EMAN::Processor::params, EMAN::EMData::phase_cog(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), t, and EMAN::EMData::translate().
05808 { 05809 if (!image) { 05810 LOGWARN("NULL Image"); 05811 return; 05812 } 05813 05814 int int_shift_only = params.set_default("int_shift_only",1); 05815 05816 vector<float> pcog = image->phase_cog(); 05817 05818 int dims = image->get_ndim(); 05819 05820 if (int_shift_only) { 05821 int dx=-int(pcog[0]+0.5f),dy=0,dz=0; 05822 if ( dims >= 2 ) dy = -int(pcog[1]+0.5); 05823 if ( dims == 3 ) dz = -int(pcog[2]+0.5); 05824 05825 Transform t; 05826 t.set_trans((float)dx,(float)dy,(float)dz); 05827 if (dims == 3) image->set_attr("xform.align3d",&t); 05828 else if (dims == 2) image->set_attr("xform.align2d",&t); 05829 05830 image->translate(dx,dy,dz); 05831 } else { 05832 float dx=-pcog[0],dy=0.0,dz=0.0; 05833 if ( dims >= 2 ) dy = -pcog[1]; 05834 if ( dims == 3 ) dz = -pcog[2]; 05835 image->translate(dx,dy,dz); 05836 05837 Transform t; 05838 t.set_trans(dx,dy,dz); 05839 if (dims == 3) image->set_attr("xform.align3d",&t); 05840 else if (dims == 2) image->set_attr("xform.align2d",&t); 05841 } 05842 }
const string PhaseToMassCenterProcessor::NAME = "xform.phasecenterofmass" [static] |