EMAN::RotateTranslateAlignerIterative Class Reference

Iterative rotational, translational alignment. More...

#include <aligner.h>

Inheritance diagram for EMAN::RotateTranslateAlignerIterative:

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

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 Public Attributes

static const string NAME = "rotate_translate_iterative"

Detailed Description

Iterative rotational, translational alignment.

Basically, we find the best translation, and move to that pointer then we find the best rotation and rotate to that point. Next we iterate X times.

Parameters:
maxshift Maximum translation in pixels
r1 inner ring
r2 outer ring
maxiter maximum number of alignment iterations
nozero Zero translation not permitted (useful for CCD images)
Author:
John Flanagan
Date:
Oct 2010

Definition at line 393 of file aligner.h.


Member Function Documentation

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

Implements EMAN::Aligner.

Definition at line 399 of file aligner.h.

References align().

00400                 {
00401                         return align(this_img, to_img, "sqeuclidean", Dict());
00402                 }

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

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

Referenced by align().

00438 {
00439         int maxiter = params.set_default("maxiter", 3);
00440         
00441         Dict trans_params;
00442         trans_params["intonly"] = 0;
00443         trans_params["maxshift"] = params.set_default("maxshift", -1);
00444         trans_params["useflcf"] = params.set_default("useflcf",0);
00445         trans_params["nozero"] = params.set_default("nozero",false);
00446         
00447         Dict rot_params;
00448         rot_params["r1"] = params.set_default("r1", -1);
00449         rot_params["r2"] = params.set_default("r2", -1);
00450         
00451         Transform t;
00452         EMData * moving_img = this_img;
00453         for(int it = 0; it < maxiter; it++){
00454                 
00455                 // First do a translational alignment
00456                 EMData * trans_align = moving_img->align("translational", to, trans_params, cmp_name, cmp_params);
00457                 Transform * tt = trans_align->get_attr("xform.align2d");
00458                 t = *tt*t;
00459                 delete tt;
00460 
00461                 //now do rotation
00462                 EMData * rottrans_align = trans_align->align("rotational.iterative", to, rot_params, cmp_name, cmp_params);
00463                 Transform * rt = rottrans_align->get_attr("xform.align2d");
00464                 t = *rt*t;
00465                 delete trans_align; trans_align = 0;
00466                 delete rottrans_align; rottrans_align = 0;
00467                 delete rt;
00468                 
00469                 //this minimizes interpolation errors (all images that are futher processed will be interpolated at most twice)
00470                 if(it > 0){delete moving_img;}
00471                 
00472                 moving_img = this_img->process("xform",Dict("transform",&t));  //iterate
00473         }
00474         
00475         //write the total transformation;       
00476         moving_img->set_attr("xform.align2d", &t);
00477         
00478         return moving_img;
00479 }

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

Implements EMAN::Aligner.

Definition at line 409 of file aligner.h.

00410                 {
00411                         return "Performs rotational alignment and follows this with translational alignment using the iterative method.";
00412                 }

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

References NAME.

00405                 {
00406                         return NAME;
00407                 }

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

Implements EMAN::Aligner.

Definition at line 419 of file aligner.h.

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

00420                 {
00421                         TypeDict d;
00422                         //d.put("usedot", EMObject::INT);
00423                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00424                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00425                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00426                         d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00427                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00428                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00429                         return d;
00430                 }

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

Definition at line 414 of file aligner.h.

00415                 {
00416                         return new RotateTranslateAlignerIterative();
00417                 }


Member Data Documentation

const string RotateTranslateAlignerIterative::NAME = "rotate_translate_iterative" [static]

Definition at line 432 of file aligner.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:08:36 2011 for EMAN2 by  doxygen 1.4.7