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 1676 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 1685 of file aligner.h.

References align().

01686                         {
01687                                 return align(this_img, to_img, "ccc.tomo", Dict());
01688                         }

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

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

02808 {
02809 
02810         vector<Dict> alis = xform_align_nbest(this_img,to,1,cmp_name,cmp_params);
02811 
02812         Transform* tr = (Transform*) alis[0]["xform.align3d"];
02813         EMData* soln = this_img->process("xform",Dict("transform",tr));
02814         soln->set_attr("xform.align3d",tr);
02815         delete tr; tr = 0;
02816 
02817         return soln;
02818 
02819 }

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

Implements EMAN::Aligner.

Definition at line 1700 of file aligner.h.

01701                         {
01702                                 return "3D symmetry aligner";
01703                         }

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 1695 of file aligner.h.

01696                         {
01697                                 return NAME;
01698                         }

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

Implements EMAN::Aligner.

Definition at line 1710 of file aligner.h.

References EMAN::TypeDict::put().

01711                         {
01712                                 TypeDict d;
01713                                 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos");
01714                                 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis");
01715                                 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01716                                 return d;
01717                         }

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

Definition at line 1705 of file aligner.h.

01706                         {
01707                                 return new RT3DSymmetryAligner();
01708                         }

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 2821 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().

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


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 Tue Jun 11 13:47:50 2013 for EMAN2 by  doxygen 1.3.9.1