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

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

rotational, translational alignment More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateAligner:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual EMDataalign (EMData *this_img, EMData *to_img, const string &cmp_name="dot", 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 string get_desc () const
virtual TypeDict get_param_types () const

Static Public Member Functions

AlignerNEW ()

Static Public Attributes

const string NAME = "rotate_translate"

Detailed Description

rotational, translational alignment

Parameters:
maxshift Maximum translation in pixels
nozero Zero translation not permitted (useful for CCD images)
rfp_mode Either 0,1 or 2. A temporary flag for testing the rotational foot print

Definition at line 410 of file aligner.h.


Member Function Documentation

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

Implements EMAN::Aligner.

Definition at line 416 of file aligner.h.

References align().

00417                 {
00418                         return align(this_img, to_img, "sqeuclidean", Dict());
00419                 }

EMData * RotateTranslateAligner::align EMData this_img,
EMData to_img,
const string &  cmp_name = "dot",
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_img The image to be compared.
to_img 'this_img" is aligned with 'to_img'.
cmp_name The comparison method to compare the two images.
cmp_params The parameter dictionary for comparison method.
Returns:
The aligned image.

Implements EMAN::Aligner.

Definition at line 692 of file aligner.cpp.

References EMAN::EMData::align(), EMAN::RotationalAligner::align_180_ambiguous(), EMAN::EMData::cmp(), EMAN::EMData::copy(), EMAN::EMData::get_attr(), EMAN::Transform::get_rotation(), EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), EMAN::Transform::set_rotation(), and t.

00694 {
00695 
00696 #ifdef EMAN2_USING_CUDA
00697         if(EMData::usecuda == 1) {
00698                 //if(!this_img->getcudarwdata()) this_img->copy_to_cuda();
00699                 //if(!to->getcudarwdata()) to->copy_to_cuda();
00700         }
00701 #endif
00702 
00703         // Get the 180 degree ambiguously rotationally aligned and its 180 degree rotation counterpart
00704         int rfp_mode = params.set_default("rfp_mode",2);
00705         EMData *rot_align  =  RotationalAligner::align_180_ambiguous(this_img,to,rfp_mode);
00706         Transform * tmp = rot_align->get_attr("xform.align2d");
00707         Dict rot = tmp->get_rotation("2d");
00708         float rotate_angle_solution = rot["alpha"];
00709         delete tmp;
00710 
00711         EMData *rot_align_180 = rot_align->copy();
00712         rot_align_180->process_inplace("math.rotate.180");
00713 
00714         Dict trans_params;
00715         trans_params["intonly"]  = 0;
00716         trans_params["maxshift"] = params.set_default("maxshift", -1);
00717         trans_params["useflcf"]=params.set_default("useflcf",0);
00718 
00719         // Do the first case translational alignment
00720         trans_params["nozero"]   = params.set_default("nozero",false);
00721         EMData* rot_trans = rot_align->align("translational", to, trans_params, cmp_name, cmp_params);
00722         if( rot_align ) { // Clean up
00723                 delete rot_align;
00724                 rot_align = 0;
00725         }
00726 
00727         // Do the second case translational alignment
00728         EMData*  rot_180_trans = rot_align_180->align("translational", to, trans_params, cmp_name, cmp_params);
00729         if( rot_align_180 )     { // Clean up
00730                 delete rot_align_180;
00731                 rot_align_180 = 0;
00732         }
00733 
00734         // Finally decide on the result
00735         float cmp1 = rot_trans->cmp(cmp_name, to, cmp_params);
00736         float cmp2 = rot_180_trans->cmp(cmp_name, to, cmp_params);
00737 
00738         EMData *result = 0;
00739         if (cmp1 < cmp2) { // Assumes smaller is better - thus all comparitors should support "smaller is better"
00740                 if( rot_180_trans )     {
00741                         delete rot_180_trans;
00742                         rot_180_trans = 0;
00743                 }
00744                 result = rot_trans;
00745         }
00746         else {
00747                 if( rot_trans ) {
00748                         delete rot_trans;
00749                         rot_trans = 0;
00750                 }
00751                 result = rot_180_trans;
00752                 rotate_angle_solution -= 180.f;
00753         }
00754 
00755         Transform* t = result->get_attr("xform.align2d");
00756         t->set_rotation(Dict("type","2d","alpha",rotate_angle_solution));
00757         result->set_attr("xform.align2d",t);
00758         delete t;
00759 
00760         return result;
00761 }

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

Implements EMAN::Aligner.

Definition at line 426 of file aligner.h.

00427                 {
00428                         return "Performs rotational alignment and follows this with translational alignment.";
00429                 }

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

00422                 {
00423                         return NAME;
00424                 }

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

Implements EMAN::Aligner.

Definition at line 436 of file aligner.h.

References EMAN::TypeDict::put().

00437                 {
00438                         TypeDict d;
00439                         //d.put("usedot", EMObject::INT);
00440                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00441                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00442                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00443                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00444                         return d;
00445                 }

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

Definition at line 431 of file aligner.h.

00432                 {
00433                         return new RotateTranslateAligner();
00434                 }


Member Data Documentation

const string RotateTranslateAligner::NAME = "rotate_translate" [static]
 

Definition at line 63 of file aligner.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Aug 13 13:41:27 2012 for EMAN2 by  doxygen 1.3.9.1