EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::SymAlignProcessor Class Reference

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

#include <aligner.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 EMDataalign (EMData *this_img, EMData *to_img, const string &cmp_name="ccc", const Dict &cmp_params=Dict()) const
 To align 'this_img' with another image passed in through its parameters.
virtual EMDataalign (EMData *this_img, EMData *to_img) const
virtual string get_name () const
 Get the Aligner's name.
virtual TypeDict get_param_types () const
virtual string get_desc () const

Static Public Member Functions

static AlignerNEW ()

Static Public Attributes

static const string NAME = "symalign"

Detailed Description

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

Works by searching over a Grid and maximizing the recon variance after symmetrization. NOTE: This function is depricated. Use the SymAlignProcessorQuat procssor instead.

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

Definition at line 1170 of file aligner.h.


Member Function Documentation

EMData * SymAlignProcessor::align ( EMData this_img,
EMData to_img,
const string &  cmp_name = "ccc",
const Dict cmp_params = Dict() 
) const [virtual]

To align 'this_img' with another image passed in through its parameters.

The alignment uses a user-given comparison method to compare the two images. If none is given, a default one is used.

Parameters:
this_imgThe image to be compared.
to_img'this_img" is aligned with 'to_img'.
cmp_nameThe comparison method to compare the two images.
cmp_paramsThe parameter dictionary for comparison method.
Returns:
The aligned image.

Implements EMAN::Aligner.

Definition at line 1529 of file aligner.cpp.

References EMAN::Averager::add_image(), EMAN::Averager::finish(), EMAN::Symmetry3D::gen_orientations(), EMAN::EMData::get_attr(), EMAN::Symmetry3D::get_symmetries(), EMAN::Aligner::params, phi, EMAN::EMData::process(), EMAN::Dict::set_default(), EMAN::Transform::set_rotation(), and t.

Referenced by align().

{
        
        // Set parms
        float dphi = params.set_default("dphi",10.f);
        float lphi = params.set_default("lphi",0.0f);
        float uphi = params.set_default("uphi",359.9f);
        
        Dict d;
        d["inc_mirror"] = true;
        d["delta"] = params.set_default("delta",10.f);
        
        //Genrate points on a sphere in an asymmetric unit
        Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1"));
        vector<Transform> transforms = sym->gen_orientations((string)params.set_default("orientgen","eman"),d);
        
        //Genrate symmetry related orritenations
        vector<Transform> syms = Symmetry3D::get_symmetries((string)params["sym"]);
        
        float bestquality = 0.0f;
        EMData* bestimage = 0;
        for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) {
                Dict tparams = trans_it->get_params("eman");
                Transform t(tparams);
                for( float phi = lphi; phi < uphi; phi += dphi ) {
                        tparams["phi"] = phi;
                        t.set_rotation(tparams);
                        
                        //Get the averagaer
                        Averager* imgavg = Factory<Averager>::get((string)params.set_default("avger","mean")); 
                        //Now make the averages
                        for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) {
                                Transform sympos = (*it)*t;
                                EMData* transformed = this_img->process("xform",Dict("transform",&sympos));
                                imgavg->add_image(transformed);
                                delete transformed;
                        }
                        
                        EMData* symptcl=imgavg->finish();
                        delete imgavg;
                        //See which average is the best
                        float quality = symptcl->get_attr("sigma");
                        cout << quality << " " << phi << endl;
                        if(quality > bestquality) {
                                bestquality = quality;
                                bestimage = symptcl;
                        } else {
                                delete symptcl;
                        }
                }
        }
        if(sym != 0) delete sym;
        
        return bestimage;
}
virtual EMData* EMAN::SymAlignProcessor::align ( EMData this_img,
EMData to_img 
) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 1175 of file aligner.h.

References align().

                        {
                                return align(this_img, to_img, "ccc", Dict());
                        }
virtual string EMAN::SymAlignProcessor::get_desc ( ) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 1201 of file aligner.h.

                        {
                                return "The image is centered and rotated to the standard orientation for the specified symmetry";
                        }
virtual string EMAN::SymAlignProcessor::get_name ( ) const [inline, virtual]

Get the Aligner's name.

Each Aligner is identified by a unique name.

Returns:
The Aligner's name.

Implements EMAN::Aligner.

Definition at line 1179 of file aligner.h.

References NAME.

                        {
                                return NAME;
                        }
virtual TypeDict EMAN::SymAlignProcessor::get_param_types ( ) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 1189 of file aligner.h.

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

                        {
                                TypeDict d;
                                d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" );
                                d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
                                d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
                                d.put("lphi", EMObject::FLOAT,"Lower bound for phi. Default it 0");
                                d.put("uphi", EMObject::FLOAT,"Upper bound for phi. Default it 359.9");
                                d.put("avger", EMObject::STRING, "The sort of averager to use, Default=mean" );
                                return d;
                        }
static Aligner* EMAN::SymAlignProcessor::NEW ( ) [inline, static]

Definition at line 1184 of file aligner.h.

                        {
                                return new SymAlignProcessor();
                        }

Member Data Documentation

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

Definition at line 1206 of file aligner.h.

Referenced by get_name().


The documentation for this class was generated from the following files: