Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

ProcessorNEW ()

Static Public Attributes

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.

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

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 1566 of file processor.h.

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.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 1580 of file processor.h.

References EMAN::TypeDict::put().

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                         }

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

Definition at line 1571 of file processor.h.

01572                         {
01573                                 return new SymAlignProcessor();
01574                         }

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 908 of file processor.cpp.

References EMAN::Averager::add_image(), EMAN::Averager::finish(), EMAN::Symmetry3D::gen_orientations(), EMAN::Factory< T >::get(), EMAN::EMData::get_attr(), EMAN::FactoryBase::get_params(), EMAN::Symmetry3D::get_symmetries(), phi, EMAN::EMData::process(), EMAN::Dict::set_default(), EMAN::Transform::set_rotation(), 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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 961 of file processor.cpp.

00962 {
00963         cout << "Not implemented yet" << endl;
00964 }


Member Data Documentation

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

Definition at line 95 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:50:55 2011 for EMAN2 by  doxygen 1.3.9.1