#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 1525 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 1554 of file processor.h.
01555 { 01556 return "The image is centered and rotated to the standard orientation for the specified symmetry"; 01557 }
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 1528 of file processor.h.
References NAME.
01529 { 01530 return NAME; 01531 }
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 1542 of file processor.h.
References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.
01543 { 01544 TypeDict d; 01545 d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" ); 01546 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10"); 01547 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10"); 01548 d.put("lphi", EMObject::FLOAT,"Lower bound for phi. Default it 0"); 01549 d.put("uphi", EMObject::FLOAT,"Upper bound for phi. Default it 359.9"); 01550 d.put("avger", EMObject::STRING, "The sort of averager to use, Default=mean" ); 01551 return d; 01552 }
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 880 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.
00881 { 00882 00883 // Set parms 00884 float dphi = params.set_default("dphi",10.f); 00885 float lphi = params.set_default("lphi",0.0f); 00886 float uphi = params.set_default("uphi",359.9f); 00887 00888 Dict d; 00889 d["inc_mirror"] = true; 00890 d["delta"] = params.set_default("delta",10.f); 00891 00892 //Genrate points on a sphere in an asymmetric unit 00893 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1")); 00894 vector<Transform> transforms = sym->gen_orientations((string)params.set_default("orientgen","eman"),d); 00895 00896 //Genrate symmetry related orritenations 00897 vector<Transform> syms = Symmetry3D::get_symmetries((string)params["sym"]); 00898 00899 float bestquality = 0.0f; 00900 EMData* bestimage = 0; 00901 for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) { 00902 Dict tparams = trans_it->get_params("eman"); 00903 Transform t(tparams); 00904 for( float phi = lphi; phi < uphi; phi += dphi ) { 00905 tparams["phi"] = phi; 00906 t.set_rotation(tparams); 00907 00908 //Get the averagaer 00909 Averager* imgavg = Factory<Averager>::get((string)params.set_default("avger","mean")); 00910 //Now make the averages 00911 for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) { 00912 Transform sympos = t*(*it); 00913 EMData* transformed = image->process("xform",Dict("transform",&sympos)); 00914 imgavg->add_image(transformed); 00915 delete transformed; 00916 } 00917 00918 EMData* symptcl=imgavg->finish(); 00919 delete imgavg; 00920 //See which average is the best 00921 float quality = symptcl->get_attr("sigma"); 00922 if(quality > bestquality) { 00923 bestquality = quality; 00924 bestimage = symptcl; 00925 } else { 00926 delete symptcl; 00927 } 00928 } 00929 } 00930 return bestimage; 00931 }
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 933 of file processor.cpp.
const string SymAlignProcessor::NAME = "xform.symalign" [static] |