EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::RT3DSymmetryAligner Class Reference

3D rotational symmetry aligner. More...

#include <aligner.h>

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

Public Member Functions

virtual EMDataalign (EMData *this_img, EMData *to_img, const string &cmp_name="ccc.tomo", const Dict &cmp_params=Dict()) const
 See Aligner comments for more details. More...
 
virtual EMDataalign (EMData *this_img, EMData *to_img) const
 See Aligner comments for more details. More...
 
virtual vector< Dictxform_align_nbest (EMData *this_img, EMData *to_img, const unsigned int nsoln, const string &cmp_name, const Dict &cmp_params) const
 See Aligner comments for more details. More...
 
virtual string get_name () const
 Get the Aligner's name. More...
 
virtual string get_desc () const
 
virtual TypeDict get_param_types () const
 
- Public Member Functions inherited from EMAN::Aligner
virtual ~Aligner ()
 
virtual Dict get_params () const
 Get the Aligner parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the Aligner parameters using a key/value dictionary. More...
 

Static Public Member Functions

static AlignerNEW ()
 

Static Public Attributes

static const string NAME = "rotate_symmetry_3d"
 

Additional Inherited Members

- Protected Attributes inherited from EMAN::Aligner
Dict params
 

Detailed Description

3D rotational symmetry aligner.

This aligner takes a map, which must be first aligned to the symmetry axis, and rotates it to it symmetric positions. This is used to check for pseudo symmetry (such as finding the tail of an icosahedral virus). A list of best matches (moving to a reference is produced. Alternativly, a rotated verison of the moving map is returned.

Parameters
symThe symmtery to use
verboseTurn this on to have useful information printed to standard out
Author
John Flanagan
Date
Mar 2011

Definition at line 2030 of file aligner.h.

Member Function Documentation

◆ align() [1/2]

virtual EMData * EMAN::RT3DSymmetryAligner::align ( EMData this_img,
EMData to_img 
) const
inlinevirtual

See Aligner comments for more details.

Implements EMAN::Aligner.

Definition at line 2039 of file aligner.h.

2040 {
2041 return align(this_img, to_img, "ccc.tomo", Dict());
2042 }
virtual EMData * align(EMData *this_img, EMData *to_img, const string &cmp_name="ccc.tomo", const Dict &cmp_params=Dict()) const
See Aligner comments for more details.

References align().

◆ align() [2/2]

virtual EMData * EMAN::RT3DSymmetryAligner::align ( EMData this_img,
EMData to_img,
const string &  cmp_name = "ccc.tomo",
const Dict cmp_params = Dict() 
) const
virtual

See Aligner comments for more details.

Implements EMAN::Aligner.

Referenced by align().

◆ get_desc()

virtual string EMAN::RT3DSymmetryAligner::get_desc ( ) const
inlinevirtual

Implements EMAN::Aligner.

Definition at line 2054 of file aligner.h.

2055 {
2056 return "3D symmetry aligner";
2057 }

◆ get_name()

virtual string EMAN::RT3DSymmetryAligner::get_name ( ) const
inlinevirtual

Get the Aligner's name.

Each Aligner is identified by a unique name.

Returns
The Aligner's name.

Implements EMAN::Aligner.

Definition at line 2049 of file aligner.h.

2050 {
2051 return NAME;
2052 }
static const string NAME
Definition: aligner.h:2073

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::RT3DSymmetryAligner::get_param_types ( ) const
inlinevirtual

Implements EMAN::Aligner.

Definition at line 2064 of file aligner.h.

2065 {
2066 TypeDict d;
2067 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos");
2068 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis");
2069 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
2070 return d;
2071 }

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

◆ NEW()

static Aligner * EMAN::RT3DSymmetryAligner::NEW ( )
inlinestatic

Definition at line 2059 of file aligner.h.

2060 {
2061 return new RT3DSymmetryAligner();
2062 }

◆ xform_align_nbest()

vector< Dict > RT3DSymmetryAligner::xform_align_nbest ( EMData this_img,
EMData to_img,
const unsigned int  nsoln,
const string &  cmp_name,
const Dict cmp_params 
) const
virtual

See Aligner comments for more details.

Reimplemented from EMAN::Aligner.

Definition at line 4592 of file aligner.cpp.

4593{
4594
4595 bool verbose = params.set_default("verbose",false);
4596 Transform* ixform;
4597 if (params.has_key("transform") ) {
4598 ixform = params["transform"];
4599 }else{
4600 ixform = new Transform(); // is the identity
4601 }
4602
4603 //Initialize a soln dict
4604 vector<Dict> solns;
4605 if (nsoln == 0) return solns; // What was the user thinking?
4606 for (unsigned int i = 0; i < nsoln; ++i ) {
4607 Dict d;
4608 d["score"] = 1.e24;
4609 Transform t; // identity by default
4610 d["xform.align3d"] = &t; // deep copy is going on here
4611 solns.push_back(d);
4612 }
4613
4614 #ifdef EMAN2_USING_CUDA
4615 if(EMData::usecuda == 1) {
4616 cout << "Using CUDA for 3D sym alignment" << endl;
4617 if(!this_img->getcudarwdata()) this_img->copy_to_cudaro();
4618 if(!to->getcudarwdata()) to->copy_to_cuda();
4619 }
4620 #endif
4621
4622 //Generate symmetry related orientations
4623 vector<Transform> syms = Symmetry3D::get_symmetries((string)params.set_default("sym","icos"));
4624 Cmp* c = Factory <Cmp>::get(cmp_name, cmp_params);
4625
4626 float score = 0.0f;
4627 for ( vector<Transform>::const_iterator symit = syms.begin(); symit != syms.end(); ++symit ) {
4628 //Here move to sym position and compute the score
4629 Transform sympos = (*symit)*(*ixform);
4630 EMData* transformed = this_img->process("xform",Dict("transform", &sympos));
4631 score = c->cmp(transformed,to);
4632 delete transformed; transformed = 0;
4633
4634 if (verbose) {
4635 Dict rots = sympos.get_rotation("eman");
4636 cout <<"Score is: " << score << " az " << float(rots["az"]) << " alt " << float(rots["alt"]) << " phi " << float(rots["phi"]) << endl;
4637 }
4638
4639 unsigned int j = 0;
4640 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) {
4641 if ( (float)(*it)["score"] > score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy
4642 vector<Dict>::reverse_iterator rit = solns.rbegin();
4643 copy(rit+1,solns.rend()-j,rit);
4644 Dict& d = (*it);
4645 d["score"] = score;
4646 d["xform.align3d"] = &sympos; // deep copy is going on here
4647 break;
4648 }
4649 }
4650 }
4651
4652 if (c != 0) delete c;
4653
4654 return solns;
4655}
Dict params
Definition: aligner.h:147
Cmp class defines image comparison method.
Definition: cmp.h:82
virtual float cmp(EMData *image, EMData *with) const =0
To compare 'image' with another image passed in through its parameters.
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
Factory is used to store objects to create new instances.
Definition: emobject.h:725
static vector< Transform > get_symmetries(const string &symmetry)
Definition: symmetry.cpp:1240
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
Dict get_rotation(const string &euler_type="eman") const
Get a rotation in any Euler format.
Definition: transform.cpp:829
EMData * copy() const
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....

References EMAN::Cmp::cmp(), copy(), EMAN::Transform::get_rotation(), EMAN::Symmetry3D::get_symmetries(), EMAN::Dict::has_key(), EMAN::Aligner::params, and EMAN::Dict::set_default().

Member Data Documentation

◆ NAME

const string RT3DSymmetryAligner::NAME = "rotate_symmetry_3d"
static

Definition at line 2073 of file aligner.h.

Referenced by get_name().


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