EMAN::SymAlignProcessor Class Reference

Aligns a particle with the specified symmetry into the standard orientation for that symmetry. More...

#include <processor.h>

Inheritance diagram for EMAN::SymAlignProcessor:

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

Collaboration graph
[legend]
List of all members.

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 EMDataprocess (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 ProcessorNEW ()

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
Exceptions:
ImageDimensionException if the image is not 1,2 or 3D.

Region get_clip_region (vector< int > &translation, const EMData *const image) const
 Get the clip region that will achieve the desired translation
Exceptions:
ImageDimensionException if the image is not 1,2 or 3D.


Detailed Description

Aligns a particle with the specified symmetry into the standard orientation for that symmetry.

Author:
Steve Ludtke and John Flanagan
Date:
February 2011
Parameters:
sym A string specifying the symmetry under which to do the alignment

Definition at line 1429 of file processor.h.


Member Function Documentation

void EMAN::SymAlignProcessor::assert_valid_aspect ( const vector< int > &  translation,
const EMData *const   image 
) const [private]

Check that the particular aspect is valid

Exceptions:
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

Exceptions:
ImageDimensionException if the image is not 1,2 or 3D.

Parameters:
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.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 1458 of file processor.h.

01459                         {
01460                                 return "The image is centered and rotated to the standard orientation for the specified symmetry";
01461                         }

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

References NAME.

01433                         {
01434                                 return NAME;
01435                         }

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.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 1446 of file processor.h.

References EMAN::EMObject::FLOAT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

01447                         {
01448                                 TypeDict d;
01449                                 d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" );
01450                                 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
01451                                 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01452                                 d.put("lphi", EMObject::FLOAT,"Lower bound for phi. Default it 0");
01453                                 d.put("uphi", EMObject::FLOAT,"Upper bound for phi. Default it 359.9");
01454                                 d.put("avger", EMObject::STRING, "The sort of averager to use, Default=mean" );
01455                                 return d;
01456                         }

static Processor* EMAN::SymAlignProcessor::NEW (  )  [inline, static]

Definition at line 1437 of file processor.h.

01438                         {
01439                                 return new SymAlignProcessor();
01440                         }

EMData * SymAlignProcessor::process ( const EMData *const   image  )  [virtual]

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.

Parameters:
image The image will be copied, actual process happen on copy of image.
Returns:
the image processing result, may or may not be the same size of the input image

Reimplemented from EMAN::Processor.

Definition at line 874 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.

00875 {
00876         
00877         // Set parms
00878         float dphi = params.set_default("dphi",10.f);
00879         float lphi = params.set_default("lphi",0.0f);
00880         float uphi = params.set_default("uphi",359.9f);
00881         
00882         Dict d;
00883         d["inc_mirror"] = true;
00884         d["delta"] = params.set_default("delta",10.f);
00885         
00886         //Genrate points on a sphere in an asymmetric unit
00887         Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1"));
00888         vector<Transform> transforms = sym->gen_orientations((string)params.set_default("orientgen","eman"),d);
00889         
00890         //Genrate symmetry related orritenations
00891         vector<Transform> syms = Symmetry3D::get_symmetries((string)params["sym"]);
00892         
00893         float bestquality = 0.0f;
00894         EMData* bestimage;
00895         for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) {
00896                 Dict tparams = trans_it->get_params("eman");
00897                 Transform t(tparams);
00898                 for( float phi = lphi; phi < uphi; phi += dphi ) {
00899                         tparams["phi"] = phi;
00900                         t.set_rotation(tparams);
00901                         
00902                         //Get the averagaer
00903                         Averager* imgavg = Factory<Averager>::get((string)params.set_default("avger","mean")); 
00904                         //Now make the averages
00905                         for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) {
00906                                 Transform sympos = t*(*it);
00907                                 EMData* transformed = image->process("xform",Dict("transform",&sympos));
00908                                 imgavg->add_image(transformed);
00909                                 delete transformed;
00910                         }
00911                         
00912                         EMData* symptcl=imgavg->finish();
00913                         delete imgavg;
00914                         //See which average is the best
00915                         float quality = symptcl->get_attr("sigma");
00916                         if(quality > bestquality) {
00917                                 bestquality = quality;
00918                                 bestimage = symptcl;
00919                         } else {
00920                                 delete symptcl;
00921                         }
00922                 }
00923         }
00924         return bestimage;
00925 }

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 927 of file processor.cpp.

00928 {
00929         cout << "Not implemented yet" << endl;
00930 }


Member Data Documentation

const string SymAlignProcessor::NAME = "xform.symalign" [static]

Definition at line 1463 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:02:20 2011 for EMAN2 by  doxygen 1.4.7