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 1525 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 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.

Returns:
The processor's 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.

Returns:
A dictionary containing the parameter info.

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]

Definition at line 1533 of file processor.h.

01534                         {
01535                                 return new SymAlignProcessor();
01536                         }

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

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 933 of file processor.cpp.

00934 {
00935         cout << "Not implemented yet" << endl;
00936 }


Member Data Documentation

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

Definition at line 1559 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon May 2 13:30:04 2011 for EMAN2 by  doxygen 1.4.7