EMAN::RotateTranslateFlipAlignerIterative Class Reference

rotational, translational and flip alignment, iterative style More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateFlipAlignerIterative:

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

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

static AlignerNEW ()
static TypeDict static_get_param_types ()

Static Public Attributes

static const string NAME = "rotate_translate_flip_iterative"

Detailed Description

rotational, translational and flip alignment, iterative style

Parameters:
flip 
r1 inner ring
r2 outer ring
maxiter maximum number of alignment iterations
maxshift Maximum translation in pixels
Author:
John Flanagan
Date:
Oct 2010

Definition at line 674 of file aligner.h.


Member Function Documentation

virtual EMData* EMAN::RotateTranslateFlipAlignerIterative::align ( EMData this_img,
EMData to_img 
) const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 679 of file aligner.h.

References align().

00680                 {
00681                         return align(this_img, to_img, "sqeuclidean", Dict());
00682                 }

EMData * RotateTranslateFlipAlignerIterative::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 671 of file aligner.cpp.

References EMAN::EMData::align(), EMAN::EMData::cmp(), cmp1(), cmp2(), EMAN::EMData::get_attr(), EMAN::Aligner::params, EMAN::EMData::process(), EMAN::EMData::process_inplace(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and t.

Referenced by align().

00673 {
00674         // Get the non flipped rotational, tranlsationally aligned image
00675         Dict rt_params("maxshift", params["maxshift"],"r1",params.set_default("r1",-1),"r2",params.set_default("r2",-1));
00676         EMData *rot_trans_align = this_img->align("rotate_translate_iterative",to,rt_params,cmp_name, cmp_params);
00677 
00678         // Do the same alignment, but using the flipped version of the image
00679         EMData *flipped = params.set_default("flip", (EMData *) 0);
00680         bool delete_flag = false;
00681         if (flipped == 0) {
00682                 flipped = to->process("xform.flip", Dict("axis", "x"));
00683                 delete_flag = true;
00684         }
00685 
00686         EMData * rot_trans_align_flip = this_img->align("rotate_translate_iterative", flipped, rt_params, cmp_name, cmp_params);
00687         Transform* t = rot_trans_align_flip->get_attr("xform.align2d");
00688         t->set_mirror(true);
00689         rot_trans_align_flip->set_attr("xform.align2d",t);
00690         delete t;
00691 
00692         // Now finally decide on what is the best answer
00693         float cmp1 = rot_trans_align->cmp(cmp_name, to, cmp_params);
00694         float cmp2 = rot_trans_align_flip->cmp(cmp_name, flipped, cmp_params);
00695 
00696         if (delete_flag){
00697                 if(flipped) {
00698                         delete flipped;
00699                         flipped = 0;
00700                 }
00701         }
00702 
00703         EMData *result = 0;
00704         if (cmp1 < cmp2 )  {
00705 
00706                 if( rot_trans_align_flip ) {
00707                         delete rot_trans_align_flip;
00708                         rot_trans_align_flip = 0;
00709                 }
00710                 result = rot_trans_align;
00711         }
00712         else {
00713                 if( rot_trans_align ) {
00714                         delete rot_trans_align;
00715                         rot_trans_align = 0;
00716                 }
00717                 result = rot_trans_align_flip;
00718                 result->process_inplace("xform.flip",Dict("axis","x"));
00719         }
00720 
00721         return result;
00722 }

virtual string EMAN::RotateTranslateFlipAlignerIterative::get_desc (  )  const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 689 of file aligner.h.

00690                 {
00691                         return " Does two 'rotate_translate.iterative' alignments, one to accommodate for possible handedness change. Decided which alignment is better using a comparitor and returns the aligned image as the solution";
00692                 }

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

References NAME.

00685                 {
00686                         return NAME;
00687                 }

virtual TypeDict EMAN::RotateTranslateFlipAlignerIterative::get_param_types (  )  const [inline, virtual]

Implements EMAN::Aligner.

Definition at line 699 of file aligner.h.

References static_get_param_types().

00700                 {
00701                         return static_get_param_types();
00702                 }

static Aligner* EMAN::RotateTranslateFlipAlignerIterative::NEW (  )  [inline, static]

Definition at line 694 of file aligner.h.

00695                 {
00696                         return new RotateTranslateFlipAlignerIterative();
00697                 }

static TypeDict EMAN::RotateTranslateFlipAlignerIterative::static_get_param_types (  )  [inline, static]

Definition at line 704 of file aligner.h.

References EMAN::EMObject::EMDATA, EMAN::EMObject::INT, and EMAN::TypeDict::put().

Referenced by get_param_types().

00704                                                          {
00705                         TypeDict d;
00706                         d.put("flip", EMObject::EMDATA);
00707                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00708                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00709                         d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00710                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00711                         return d;
00712                 }


Member Data Documentation

const string RotateTranslateFlipAlignerIterative::NAME = "rotate_translate_flip_iterative" [static]

Definition at line 714 of file aligner.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:47:55 2011 for EMAN2 by  doxygen 1.4.7