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

EMAN::RT3DSymmetryAligner Class Reference
[a function or class that is CUDA enabled]

3D rotational symmetry aligner. More...

#include <aligner.h>

Inheritance diagram for EMAN::RT3DSymmetryAligner:

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

Collaboration graph
[legend]
List of all members.

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.
virtual EMDataalign (EMData *this_img, EMData *to_img) const
 See Aligner comments for more details.
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.
virtual string get_name () const
 Get the Aligner's name.
virtual string get_desc () const
virtual TypeDict get_param_types () const

Static Public Member Functions

AlignerNEW ()

Static Public Attributes

const string NAME = "rotate_symmetry_3d"

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:
sym The symmtery to use
verbose Turn this on to have useful information printed to standard out
Author:
John Flanagan
Date:
Mar 2011

Definition at line 1670 of file aligner.h.


Member Function Documentation

virtual EMData* EMAN::RT3DSymmetryAligner::align EMData this_img,
EMData to_img
const [inline, virtual]
 

See Aligner comments for more details.

Implements EMAN::Aligner.

Definition at line 1679 of file aligner.h.

References align().

01680                         {
01681                                 return align(this_img, to_img, "ccc.tomo", Dict());
01682                         }

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

Definition at line 2791 of file aligner.cpp.

References EMAN::EMData::process(), EMAN::EMData::set_attr(), and xform_align_nbest().

02792 {
02793 
02794         vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params);
02795 
02796         Transform* tr = (Transform*) alis[0]["xform.align3d"];
02797         EMData* soln = this_img->process("xform",Dict("transform",tr));
02798         soln->set_attr("xform.align3d",tr);
02799         delete tr; tr = 0;
02800 
02801         return soln;
02802 
02803 }

virtual string EMAN::RT3DSymmetryAligner::get_desc  )  const [inline, virtual]
 

Implements EMAN::Aligner.

Definition at line 1694 of file aligner.h.

01695                         {
01696                                 return "3D symmetry aligner";
01697                         }

virtual string EMAN::RT3DSymmetryAligner::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 1689 of file aligner.h.

01690                         {
01691                                 return NAME;
01692                         }

virtual TypeDict EMAN::RT3DSymmetryAligner::get_param_types  )  const [inline, virtual]
 

Implements EMAN::Aligner.

Definition at line 1704 of file aligner.h.

References EMAN::TypeDict::put().

01705                         {
01706                                 TypeDict d;
01707                                 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos");
01708                                 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis");
01709                                 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01710                                 return d;
01711                         }

Aligner* EMAN::RT3DSymmetryAligner::NEW  )  [inline, static]
 

Definition at line 1699 of file aligner.h.

01700                         {
01701                                 return new RT3DSymmetryAligner();
01702                         }

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 2805 of file aligner.cpp.

References EMAN::Cmp::cmp(), copy(), EMAN::Dict::end(), EMAN::Transform::get_rotation(), EMAN::Symmetry3D::get_symmetries(), EMAN::Dict::has_key(), EMAN::EMData::process(), and EMAN::Dict::set_default().

Referenced by align().

02806 {
02807         
02808         bool verbose = params.set_default("verbose",false);
02809         Transform* ixform;
02810         if (params.has_key("transform") ) {
02811                 ixform = params["transform"];
02812         }else{
02813                 ixform = new Transform(); // is the identity
02814         }
02815         
02816         //Initialize a soln dict
02817         vector<Dict> solns;
02818         if (nsoln == 0) return solns; // What was the user thinking?
02819         for (unsigned int i = 0; i < nsoln; ++i ) {
02820                 Dict d;
02821                 d["score"] = 1.e24;
02822                 Transform t; // identity by default
02823                 d["xform.align3d"] = &t; // deep copy is going on here
02824                 solns.push_back(d);
02825         }
02826         
02827         #ifdef EMAN2_USING_CUDA 
02828         if(EMData::usecuda == 1) {
02829                 cout << "Using CUDA for 3D sym alignment" << endl;
02830                 if(!this_img->getcudarwdata()) this_img->copy_to_cudaro();
02831                 if(!to->getcudarwdata()) to->copy_to_cuda();
02832         }
02833         #endif
02834 
02835         //Generate symmetry related orientations
02836         vector<Transform> syms = Symmetry3D::get_symmetries((string)params.set_default("sym","icos"));
02837         Cmp* c = Factory <Cmp>::get(cmp_name, cmp_params);
02838         
02839         float score = 0.0f;
02840         for ( vector<Transform>::const_iterator symit = syms.begin(); symit != syms.end(); ++symit ) {
02841                 //Here move to sym position and compute the score
02842                 Transform sympos = (*symit)*(*ixform);
02843                 EMData* transformed = this_img->process("xform",Dict("transform", &sympos));
02844                 score = c->cmp(transformed,to);
02845                 delete transformed; transformed = 0;
02846                 
02847                 if (verbose) {
02848                         Dict rots = sympos.get_rotation("eman");
02849                         cout <<"Score is: " << score << " az " << float(rots["az"]) << " alt " << float(rots["alt"]) << " phi " << float(rots["phi"]) << endl;
02850                 }
02851                 
02852                 unsigned int j = 0;
02853                 for ( vector<Dict>::iterator it = solns.begin(); it != solns.end(); ++it, ++j ) {
02854                         if ( (float)(*it)["score"] > score ) { // Note greater than - EMAN2 preferes minimums as a matter of policy
02855                                 vector<Dict>::reverse_iterator rit = solns.rbegin();
02856                                 copy(rit+1,solns.rend()-j,rit);
02857                                 Dict& d = (*it);
02858                                 d["score"] = score;
02859                                 d["xform.align3d"] = &sympos; // deep copy is going on here
02860                                 break;
02861                         }
02862                 }
02863         }
02864         
02865         if (c != 0) delete c;
02866         
02867         return solns;
02868 }


Member Data Documentation

const string RT3DSymmetryAligner::NAME = "rotate_symmetry_3d" [static]
 

Definition at line 86 of file aligner.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Aug 10 16:36:39 2012 for EMAN2 by  doxygen 1.3.9.1