#include <processor.h>
Inheritance diagram for EMAN::SymAlignProcessor:
Public Member Functions | ||||
virtual string | get_name () const | |||
Get the processor's name. | ||||
virtual void | process_inplace (EMData *image) | |||
To process an image in-place. | ||||
virtual EMData * | process (const EMData *const image) | |||
To proccess an image out-of-place. | ||||
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 | ||||
static Processor * | NEW () | |||
Static Public Attributes | ||||
static const string | NAME = "xform.symalign" | |||
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
|
sym | A string specifying the symmetry under which to do the alignment |
Definition at line 1563 of file processor.h.
void EMAN::SymAlignProcessor::assert_valid_aspect | ( | const vector< int > & | translation, | |
const EMData *const | image | |||
) | const [private] |
Check that the particular aspect is valid
ImageDimensionException | if the image is not 1,2 or 3D. |
Region EMAN::SymAlignProcessor::get_clip_region | ( | vector< int > & | translation, | |
const EMData *const | image | |||
) | const [private] |
Get the clip region that will achieve the desired translation
ImageDimensionException | if the image is not 1,2 or 3D. |
translation | the amount by which to translate | |
image | the image that will eventually used for the translation operation |
virtual string EMAN::SymAlignProcessor::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 1592 of file processor.h.
01593 { 01594 return "The image is centered and rotated to the standard orientation for the specified symmetry"; 01595 }
virtual string EMAN::SymAlignProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 1566 of file processor.h.
References NAME.
01567 { 01568 return NAME; 01569 }
virtual TypeDict EMAN::SymAlignProcessor::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 1580 of file processor.h.
References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.
01581 { 01582 TypeDict d; 01583 d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" ); 01584 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10"); 01585 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10"); 01586 d.put("lphi", EMObject::FLOAT,"Lower bound for phi. Default it 0"); 01587 d.put("uphi", EMObject::FLOAT,"Upper bound for phi. Default it 359.9"); 01588 d.put("avger", EMObject::STRING, "The sort of averager to use, Default=mean" ); 01589 return d; 01590 }
static Processor* EMAN::SymAlignProcessor::NEW | ( | ) | [inline, static] |
To proccess an image out-of-place.
For those processors which can only be processed out-of-place, override this function to give the right behavior.
image | The image will be copied, actual process happen on copy of image. |
Reimplemented from EMAN::Processor.
Definition at line 908 of file processor.cpp.
References EMAN::Averager::add_image(), EMAN::Averager::finish(), EMAN::Symmetry3D::gen_orientations(), EMAN::EMData::get_attr(), EMAN::Symmetry3D::get_symmetries(), EMAN::Processor::params, phi, EMAN::EMData::process(), EMAN::Dict::set_default(), and t.
00909 { 00910 00911 // Set parms 00912 float dphi = params.set_default("dphi",10.f); 00913 float lphi = params.set_default("lphi",0.0f); 00914 float uphi = params.set_default("uphi",359.9f); 00915 00916 Dict d; 00917 d["inc_mirror"] = true; 00918 d["delta"] = params.set_default("delta",10.f); 00919 00920 //Genrate points on a sphere in an asymmetric unit 00921 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1")); 00922 vector<Transform> transforms = sym->gen_orientations((string)params.set_default("orientgen","eman"),d); 00923 00924 //Genrate symmetry related orritenations 00925 vector<Transform> syms = Symmetry3D::get_symmetries((string)params["sym"]); 00926 00927 float bestquality = 0.0f; 00928 EMData* bestimage = 0; 00929 for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) { 00930 Dict tparams = trans_it->get_params("eman"); 00931 Transform t(tparams); 00932 for( float phi = lphi; phi < uphi; phi += dphi ) { 00933 tparams["phi"] = phi; 00934 t.set_rotation(tparams); 00935 00936 //Get the averagaer 00937 Averager* imgavg = Factory<Averager>::get((string)params.set_default("avger","mean")); 00938 //Now make the averages 00939 for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) { 00940 Transform sympos = t*(*it); 00941 EMData* transformed = image->process("xform",Dict("transform",&sympos)); 00942 imgavg->add_image(transformed); 00943 delete transformed; 00944 } 00945 00946 EMData* symptcl=imgavg->finish(); 00947 delete imgavg; 00948 //See which average is the best 00949 float quality = symptcl->get_attr("sigma"); 00950 if(quality > bestquality) { 00951 bestquality = quality; 00952 bestimage = symptcl; 00953 } else { 00954 delete symptcl; 00955 } 00956 } 00957 } 00958 return bestimage; 00959 }
void SymAlignProcessor::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 961 of file processor.cpp.
const string SymAlignProcessor::NAME = "xform.symalign" [static] |