aligner.h

Go to the documentation of this file.
00001 
00005 /*
00006  * Author: Steven Ludtke, 04/10/2003 (sludtke@bcm.edu)
00007  * Copyright (c) 2000-2006 Baylor College of Medicine
00008  *
00009  * This software is issued under a joint BSD/GNU license. You may use the
00010  * source code in this file under either license. However, note that the
00011  * complete EMAN2 and SPARX software packages have some GPL dependencies,
00012  * so you are responsible for compliance with the licenses of these packages
00013  * if you opt to use BSD licensing. The warranty disclaimer below holds
00014  * in either instance.
00015  *
00016  * This complete copyright notice must be included in any revised version of the
00017  * source code. Additional authorship citations may be added, but existing
00018  * author citations must be preserved.
00019  *
00020  * This program is free software; you can redistribute it and/or modify
00021  * it under the terms of the GNU General Public License as published by
00022  * the Free Software Foundation; either version 2 of the License, or
00023  * (at your option) any later version.
00024  *
00025  * This program is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00028  * GNU General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU General Public License
00031  * along with this program; if not, write to the Free Software
00032  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00033  *
00034  * */
00035 
00036 #ifndef eman__aligner_h__
00037 #define eman__aligner_h__ 1
00038 
00039 
00040 #include "emobject.h"
00041 
00042 
00043 namespace EMAN
00044 {
00045         class EMData;
00046         class Cmp;
00047 
00084         class Aligner
00085         {
00086           public:
00087                 virtual ~ Aligner()
00088                 {
00089                 }
00090 
00091                 virtual EMData *align(EMData * this_img, EMData * to_img) const = 0;
00092 
00104                 virtual EMData *align(EMData * this_img, EMData * to_img,
00105                                                           const string & cmp_name, const Dict& cmp_params) const = 0;
00106 
00110                 virtual string get_name() const = 0;
00111 
00112                 virtual string get_desc() const = 0;
00116                 virtual Dict get_params() const
00117                 {
00118                         return params;
00119                 }
00120 
00124                 virtual void set_params(const Dict & new_params)
00125                 {
00126                         params = new_params;
00127                 }
00128 
00129                 virtual TypeDict get_param_types() const = 0;
00130 
00144                 virtual vector<Dict> xform_align_nbest(EMData * this_img, EMData * to_img, const unsigned int nsoln, const string & cmp_name, const Dict& cmp_params) const;
00145 //              {
00146 //                      vector<Dict> solns;
00147 //                      return solns;
00148 //              }
00149 
00150           protected:
00151                 mutable Dict params;
00152 
00153 //              /** Get a Transform pointer that is currently stored in the image header corresponding to the given key.
00154 //               * If non existant then initialize a new Transform pointer, set it as the image attribute, and return it.
00155 //               * The point being that if you have to access the xform.align2d or the xform.align3d
00156 //               * attributes from multiple aligners then you always want to get the same one.
00157 //               * @param key the alignment key such as "xform.align2d" or "xform.align3d"
00158 //               * @param image the image from which the Transform pointer will be extracted (and potentially assigned to if non existant)
00159 //               * @return the Transform pointer that is currently stored in the image header corresponding to the given key.
00160 //               */
00161 //              static Transform* get_align_attr(const string& key, EMData* const image );
00162 //
00163 //              static Transform* get_set_align_attr(const string& key, EMData* const to_image, const EMData* const from_image  );
00164         };
00165 
00170         class ScaleAlignerABS:public Aligner
00171         {
00172           public: 
00174                  ScaleAlignerABS(const string& ba) : basealigner(ba)
00175                  {
00176                  }
00177                  
00179                  EMData* align_using_base(EMData * this_img, EMData * to_img,
00180                                                 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00181         
00182           protected:
00183                 const string basealigner;
00184                 Dict basealigner_params;
00185                 
00186         };
00187         
00195         class ScaleAligner:public Aligner
00196         {
00197           public:
00198                 virtual EMData * align(EMData * this_img, EMData * to_img,
00199                                                 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00200 
00201                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00202                 {
00203                         return align(this_img, to_img, "dot", Dict());
00204                 }
00205 
00206                 virtual string get_name() const
00207                 {
00208                         return NAME;
00209                 }
00210 
00211                 virtual string get_desc() const
00212                 {
00213                         return "Performs real space scale alignment";
00214                 }
00215 
00216                 static Aligner *NEW()
00217                 {
00218                         return new ScaleAligner();
00219                 }
00220 
00221                 virtual TypeDict get_param_types() const
00222                 {
00223                         TypeDict d;
00224                         d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00225                         d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00226                         d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00227                         return d;
00228                 }
00229                 
00230                 static const string NAME;
00231         };
00232         
00241         class TranslationalAligner:public Aligner
00242         {
00243           public:
00244                 virtual EMData * align(EMData * this_img, EMData * to_img,
00245                                                 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00246 
00247                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00248                 {
00249                         return align(this_img, to_img, "dot", Dict());
00250                 }
00251 
00252                 virtual string get_name() const
00253                 {
00254                         return NAME;
00255                 }
00256 
00257                 virtual string get_desc() const
00258                 {
00259                         return "Translational 2D and 3D alignment by cross-correlation";
00260                 }
00261 
00262                 static Aligner *NEW()
00263                 {
00264                         return new TranslationalAligner();
00265                 }
00266 
00267                 virtual TypeDict get_param_types() const
00268                 {
00269                         TypeDict d;
00270                         d.put("intonly", EMObject::INT,"Integer pixel translations only");
00271                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF");
00272                         d.put("maxshift", EMObject::INT,"Maximum translation in pixels");
00273                         d.put("masked", EMObject::INT,"Treat zero pixels in 'this' as a mask for normalization (default false)");
00274                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00275                         return d;
00276                 }
00277                 
00278                 static const string NAME;
00279         };
00280 
00285         class RotationalAligner:public Aligner
00286         {
00287           public:
00288                 virtual EMData * align(EMData * this_img, EMData * to_img,
00289                                                 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00290 
00291                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00292                 {
00293                         return align(this_img, to_img, "dot", Dict());
00294                 }
00295 
00296                 virtual string get_name() const
00297                 {
00298                         return NAME;
00299                 }
00300 
00301                 virtual string get_desc() const
00302                 {
00303                         return "Performs rotational alignment,works accurately if the image is precentered, normally called internally in combination with translational and flip alignment";
00304                 }
00305 
00306                 static Aligner *NEW()
00307                 {
00308                         return new RotationalAligner();
00309                 }
00310 
00311                 static EMData * align_180_ambiguous(EMData * this_img, EMData * to_img, int rfp_mode = 0);
00312 
00313                 virtual TypeDict get_param_types() const
00314                 {
00315                         TypeDict d;
00316                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print. O is the original eman1 way. 1 is just using calc_ccf without padding. 2 is using calc_mutual_correlation without padding.");
00317                         return d;
00318                 }
00319                 
00320                 static const string NAME;
00321         };
00322 
00330         class RotationalAlignerIterative:public Aligner
00331         {
00332           public:
00333                 virtual EMData * align(EMData * this_img, EMData * to_img,
00334                                                 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00335 
00336                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00337                 {
00338                         return align(this_img, to_img, "dot", Dict());
00339                 }
00340 
00341                 virtual string get_name() const
00342                 {
00343                         return NAME;
00344                 }
00345 
00346                 virtual string get_desc() const
00347                 {
00348                         return "Performs rotational alignment using the SPIDER method";
00349                 }
00350 
00351                 static Aligner *NEW()
00352                 {
00353                         return new RotationalAlignerIterative();
00354                 }
00355 
00356                 virtual TypeDict get_param_types() const
00357                 {
00358                         TypeDict d;
00359                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00360                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00361                         return d;
00362                 }
00363                 
00364                 static const string NAME;
00365         };
00366 
00369         class RotatePrecenterAligner:public Aligner
00370         {
00371           public:
00372                 virtual EMData * align(EMData * this_img, EMData * to_img,
00373                                                 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00374 
00375                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00376                 {
00377                         return align(this_img, to_img, "dot", Dict());
00378                 }
00379 
00380                 virtual string get_name() const
00381                 {
00382                         return NAME;
00383                 }
00384 
00385                 virtual string get_desc() const
00386                 {
00387                         return "Performs rotational alignment and works accurately if the image is precentered";
00388                 }
00389 
00390                 static Aligner *NEW()
00391                 {
00392                         return new RotatePrecenterAligner();
00393                 }
00394 
00395                 virtual TypeDict get_param_types() const
00396                 {
00397                         TypeDict d;
00398                         return d;
00399                 }
00400                 
00401                 static const string NAME;
00402         };
00403 
00410         class RotateTranslateAligner:public Aligner
00411         {
00412           public:
00413                   virtual EMData * align(EMData * this_img, EMData * to_img,
00414                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00415 
00416                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00417                 {
00418                         return align(this_img, to_img, "sqeuclidean", Dict());
00419                 }
00420 
00421                 virtual string get_name() const
00422                 {
00423                         return NAME;
00424                 }
00425 
00426                 virtual string get_desc() const
00427                 {
00428                         return "Performs rotational alignment and follows this with translational alignment.";
00429                 }
00430 
00431                 static Aligner *NEW()
00432                 {
00433                         return new RotateTranslateAligner();
00434                 }
00435 
00436                 virtual TypeDict get_param_types() const
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                 }
00446                 
00447                 static const string NAME;
00448         };
00449 
00460         class RotateTranslateScaleAligner:public ScaleAlignerABS
00461         {
00462           public:
00463                 
00464                 //Set the type of base aligner
00465                 RotateTranslateScaleAligner() : ScaleAlignerABS("rotate_translate")
00466                 {
00467                 }
00468 
00469                 virtual EMData * align(EMData * this_img, EMData * to_img,
00470                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00471 
00472                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00473                 {
00474                         return align(this_img, to_img, "sqeuclidean", Dict());
00475                 }
00476 
00477                 virtual string get_name() const
00478                 {
00479                         return NAME;
00480                 }
00481 
00482                 virtual string get_desc() const
00483                 {
00484                         return "Performs rotational alignment and follows this with translational and then scaling alignment.";
00485                 }
00486 
00487                 static Aligner *NEW()
00488                 {
00489                         return new RotateTranslateScaleAligner();
00490                 }
00491 
00492                 virtual TypeDict get_param_types() const
00493                 {
00494                         TypeDict d;
00495                         d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00496                         d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00497                         d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00498                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00499                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00500                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00501                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00502                         return d;
00503                 }
00504                 
00505                 static const string NAME;
00506         };
00507         
00518         class RotateTranslateAlignerIterative:public Aligner
00519         {
00520           public:
00521                 virtual EMData * align(EMData * this_img, EMData * to_img,
00522                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00523 
00524                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00525                 {
00526                         return align(this_img, to_img, "sqeuclidean", Dict());
00527                 }
00528 
00529                 virtual string get_name() const
00530                 {
00531                         return NAME;
00532                 }
00533 
00534                 virtual string get_desc() const
00535                 {
00536                         return "Performs rotational alignment and follows this with translational alignment using the iterative method.";
00537                 }
00538 
00539                 static Aligner *NEW()
00540                 {
00541                         return new RotateTranslateAlignerIterative();
00542                 }
00543 
00544                 virtual TypeDict get_param_types() const
00545                 {
00546                         TypeDict d;
00547                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00548                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00549                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00550                         d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00551                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00552                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00553                         return d;
00554                 }
00555                 
00556                 static const string NAME;
00557         };
00558 
00572         class RotateTranslateScaleAlignerIterative:public ScaleAlignerABS
00573         {
00574           public:
00575                 //Set the type of base aligner
00576                 RotateTranslateScaleAlignerIterative() : ScaleAlignerABS("rotate_translate_iterative")
00577                 {
00578                 }
00579                 
00580                 virtual EMData * align(EMData * this_img, EMData * to_img,
00581                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00582 
00583                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00584                 {
00585                         return align(this_img, to_img, "sqeuclidean", Dict());
00586                 }
00587 
00588                 virtual string get_name() const
00589                 {
00590                         return NAME;
00591                 }
00592 
00593                 virtual string get_desc() const
00594                 {
00595                         return "Performs rotational alignment and follows this with translational alignment using the iterative method. Does this for each scale and returns the best";
00596                 }
00597 
00598                 static Aligner *NEW()
00599                 {
00600                         return new RotateTranslateScaleAlignerIterative();
00601                 }
00602 
00603                 virtual TypeDict get_param_types() const
00604                 {
00605                         TypeDict d;
00606                         d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00607                         d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00608                         d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00609                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00610                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00611                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00612                         d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00613                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00614                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00615                         return d;
00616                 }
00617                 
00618                 static const string NAME;
00619         };
00620 
00630         class RotateTranslateAlignerPawel:public Aligner
00631         {
00632           public:
00633                 virtual EMData * align(EMData * this_img, EMData * to_img,
00634                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00635 
00636                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00637                 {
00638                         return align(this_img, to_img, "sqeuclidean", Dict());
00639                 }
00640 
00641                 virtual string get_name() const
00642                 {
00643                         return NAME;
00644                 }
00645 
00646                 virtual string get_desc() const
00647                 {
00648                         return "Performs rotational alignment and translation align by resampling to polar coordinates in real space.";
00649                 }
00650 
00651                 static Aligner *NEW()
00652                 {
00653                         return new RotateTranslateAlignerPawel();
00654                 }
00655 
00656                 virtual TypeDict get_param_types() const
00657                 {
00658                         TypeDict d;
00659                         //d.put("usedot", EMObject::INT);
00660                         d.put("tx", EMObject::INT, "Maximum x translation in pixels, Default = 0");
00661                         d.put("ty", EMObject::INT, "Maximum y translation in pixels, Default = 0");
00662                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00663                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00664                         return d;
00665                 }
00666                 
00667                 static const string NAME;
00668         };
00669         
00674         class RotateTranslateBestAligner:public Aligner
00675         {
00676           public:
00677                 virtual EMData * align(EMData * this_img, EMData * to_img,
00678                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00679 
00680                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00681                 {
00682                         return align(this_img, to_img, "frc", Dict());
00683                 }
00684 
00685                 virtual string get_name() const
00686                 {
00687                         return NAME;
00688                 }
00689 
00690                 virtual string get_desc() const
00691                 {
00692                         return "Full 2D alignment using 'Rotational' and 'Translational', also incorporates 2D 'Refine' alignments.";
00693                 }
00694 
00695                 static Aligner *NEW()
00696                 {
00697                         return new RotateTranslateBestAligner();
00698                 }
00699 
00700                 virtual TypeDict get_param_types() const
00701                 {
00702                         TypeDict d;
00703                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00704                         d.put("snr", EMObject::FLOATARRAY, "signal to noise ratio array");
00705                         return d;
00706                 }
00707 
00708                 static const string NAME;
00709         };
00710 
00716         class RotateFlipAligner:public Aligner
00717         {
00718           public:
00719                 virtual EMData * align(EMData * this_img, EMData * to_img,
00720                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00721                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00722                 {
00723                         return align(this_img, to_img, "dot", Dict());
00724                 }
00725                 virtual string get_name() const
00726                 {
00727                         return NAME;
00728                 }
00729 
00730                 virtual string get_desc() const
00731                 {
00732                         return "Performs two rotational alignments, one using the original image and one using the hand-flipped image. Decides which alignment is better using a comparitor and returns it";
00733                 }
00734 
00735                 static Aligner *NEW()
00736                 {
00737                         return new RotateFlipAligner();
00738                 }
00739 
00740                 virtual TypeDict get_param_types() const
00741                 {
00742                         return static_get_param_types();
00743                 }
00744 
00745                 static TypeDict static_get_param_types() {
00746                         TypeDict d;
00747 
00748                         d.put("imask", EMObject::INT);
00749                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00750                         return d;
00751                 }
00752 
00753                 static const string NAME;
00754         };
00755 
00762         class RotateFlipAlignerIterative:public Aligner
00763         {
00764           public:
00765                 virtual EMData * align(EMData * this_img, EMData * to_img,
00766                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00767                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00768                 {
00769                         return align(this_img, to_img, "dot", Dict());
00770                 }
00771                 virtual string get_name() const
00772                 {
00773                         return NAME;
00774                 }
00775 
00776                 virtual string get_desc() const
00777                 {
00778                         return "Performs two rotational alignments, iterative style, one using the original image and one using the hand-flipped image. Decides which alignment is better using a comparitor and returns it";
00779                 }
00780 
00781                 static Aligner *NEW()
00782                 {
00783                         return new RotateFlipAlignerIterative();
00784                 }
00785 
00786                 virtual TypeDict get_param_types() const
00787                 {
00788                         return static_get_param_types();
00789                 }
00790 
00791                 static TypeDict static_get_param_types() {
00792                         TypeDict d;
00793                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00794                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00795                         return d;
00796                 }
00797 
00798                 static const string NAME;
00799         };
00800         
00807         class RotateTranslateFlipAligner:public Aligner
00808         {
00809           public:
00810                 virtual EMData * align(EMData * this_img, EMData * to_img,
00811                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00812                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00813                 {
00814                         return align(this_img, to_img, "sqeuclidean", Dict());
00815                 }
00816 
00817                 virtual string get_name() const
00818                 {
00819                         return NAME;
00820                 }
00821 
00822                 virtual string get_desc() const
00823                 {
00824                         return " Does two 'rotate_translate' alignments, one to accommodate for possible handedness change. Decided which alignment is better using a comparitor and returns the aligned image as the solution";
00825                 }
00826 
00827                 static Aligner *NEW()
00828                 {
00829                         return new RotateTranslateFlipAligner();
00830                 }
00831 
00832                 virtual TypeDict get_param_types() const
00833                 {
00834                         return static_get_param_types();
00835                 }
00836 
00837                 static TypeDict static_get_param_types() {
00838                         TypeDict d;
00839 
00840                         d.put("flip", EMObject::EMDATA);
00841                         d.put("usedot", EMObject::INT);
00842                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00843                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00844                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00845                         return d;
00846                 }
00847                 
00848                 static const string NAME;
00849         };
00850 
00862         class RotateTranslateFlipScaleAligner:public ScaleAlignerABS
00863         {
00864           public:       
00865                 //Set the type of base aligner
00866                 RotateTranslateFlipScaleAligner() : ScaleAlignerABS("rotate_translate_flip")
00867                 {
00868                 }
00869 
00870                 virtual EMData * align(EMData * this_img, EMData * to_img,
00871                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00872 
00873                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00874                 {
00875                         return align(this_img, to_img, "sqeuclidean", Dict());
00876                 }
00877 
00878                 virtual string get_name() const
00879                 {
00880                         return NAME;
00881                 }
00882 
00883                 virtual string get_desc() const
00884                 {
00885                         return "Performs rotational alignment and follows this with translational and then scaling alignment.";
00886                 }
00887 
00888                 static Aligner *NEW()
00889                 {
00890                         return new RotateTranslateFlipScaleAligner();
00891                 }
00892 
00893                 virtual TypeDict get_param_types() const
00894                 {
00895                         TypeDict d;
00896                         d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00897                         d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00898                         d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00899                         d.put("flip", EMObject::EMDATA);
00900                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00901                         d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00902                         d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00903                         d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00904                         return d;
00905                 }
00906                 
00907                 static const string NAME;
00908         };
00909         
00919         class RotateTranslateFlipAlignerIterative:public Aligner
00920         {
00921           public:
00922                 virtual EMData * align(EMData * this_img, EMData * to_img,
00923                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00924                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00925                 {
00926                         return align(this_img, to_img, "sqeuclidean", Dict());
00927                 }
00928 
00929                 virtual string get_name() const
00930                 {
00931                         return NAME;
00932                 }
00933 
00934                 virtual string get_desc() const
00935                 {
00936                         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";
00937                 }
00938 
00939                 static Aligner *NEW()
00940                 {
00941                         return new RotateTranslateFlipAlignerIterative();
00942                 }
00943 
00944                 virtual TypeDict get_param_types() const
00945                 {
00946                         return static_get_param_types();
00947                 }
00948 
00949                 static TypeDict static_get_param_types() {
00950                         TypeDict d;
00951                         d.put("flip", EMObject::EMDATA);
00952                         d.put("r1", EMObject::INT, "Inner ring, pixels");
00953                         d.put("r2", EMObject::INT, "Outer ring, pixels");
00954                         d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00955                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00956                         return d;
00957                 }
00958                 
00959                 static const string NAME;
00960         };
00961         
00975         class RotateTranslateFlipScaleAlignerIterative:public ScaleAlignerABS
00976         {
00977           public:
00978                 //Set the type of base aligner
00979                 RotateTranslateFlipScaleAlignerIterative() : ScaleAlignerABS("rotate_translate_flip_iterative")
00980                 {
00981                 }
00982                 
00983                 virtual EMData * align(EMData * this_img, EMData * to_img,
00984                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00985 
00986                 virtual EMData * align(EMData * this_img, EMData * to_img) const
00987                 {
00988                         return align(this_img, to_img, "sqeuclidean", Dict());
00989                 }
00990 
00991                 virtual string get_name() const
00992                 {
00993                         return NAME;
00994                 }
00995 
00996                 virtual string get_desc() const
00997                 {
00998                         return "Performs rotational alignment and follows this with translational alignment using the iterative method. Does this for each scale and returns the best";
00999                 }
01000 
01001                 static Aligner *NEW()
01002                 {
01003                         return new RotateTranslateFlipScaleAlignerIterative();
01004                 }
01005 
01006                 virtual TypeDict get_param_types() const
01007                 {
01008                         TypeDict d;
01009                         d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
01010                         d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
01011                         d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
01012                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
01013                         d.put("flip", EMObject::EMDATA);
01014                         d.put("r1", EMObject::INT, "Inner ring, pixels");
01015                         d.put("r2", EMObject::INT, "Outer ring, pixels");
01016                         d.put("maxiter", EMObject::INT, "Maximum number of iterations");
01017                         return d;
01018                 }
01019                 
01020                 static const string NAME;
01021         };
01022         
01032         class RotateTranslateFlipAlignerPawel:public Aligner
01033         {
01034           public:
01035                 virtual EMData * align(EMData * this_img, EMData * to_img,
01036                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01037 
01038                 virtual EMData * align(EMData * this_img, EMData * to_img) const
01039                 {
01040                         return align(this_img, to_img, "sqeuclidean", Dict());
01041                 }
01042 
01043                 virtual string get_name() const
01044                 {
01045                         return NAME;
01046                 }
01047 
01048                 virtual string get_desc() const
01049                 {
01050                         return "Performs rotational alignment, translation align, and flip by resampling to polar coordinates in real space.";
01051                 }
01052 
01053                 static Aligner *NEW()
01054                 {
01055                         return new RotateTranslateFlipAlignerPawel();
01056                 }
01057 
01058                 virtual TypeDict get_param_types() const
01059                 {
01060                         TypeDict d;
01061                         //d.put("usedot", EMObject::INT);
01062                         d.put("tx", EMObject::INT, "Maximum x translation in pixels, Default = 0");
01063                         d.put("ty", EMObject::INT, "Maximum y translation in pixels, Default = 0");
01064                         d.put("r1", EMObject::INT, "Inner ring, pixels");
01065                         d.put("r2", EMObject::INT, "Outer ring, pixels");
01066                         return d;
01067                 }
01068                 
01069                 static const string NAME;
01070         };
01071         
01076         class RTFExhaustiveAligner:public Aligner
01077         {
01078           public:
01079                 virtual EMData * align(EMData * this_img, EMData * to_img,
01080                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01081                 virtual EMData * align(EMData * this_img, EMData * to_img) const
01082                 {
01083                         return align(this_img, to_img, "sqeuclidean", Dict());
01084                 }
01085 
01086                 virtual string get_name() const
01087                 {
01088                         return NAME;
01089                 }
01090 
01091                 virtual string get_desc() const
01092                 {
01093                         return "Experimental full 2D alignment with handedness check using semi-exhaustive search (not necessarily better than RTFBest)";
01094                 }
01095 
01096                 static Aligner *NEW()
01097                 {
01098                         return new RTFExhaustiveAligner();
01099                 }
01100 
01101                 virtual TypeDict get_param_types() const
01102                 {
01103                         TypeDict d;
01104 
01105                         d.put("flip", EMObject::EMDATA);
01106                         d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
01107                         return d;
01108                 }
01109                 
01110                 static const string NAME;
01111         };
01112 
01120         class RTFSlowExhaustiveAligner:public Aligner
01121         {
01122           public:
01123                 virtual EMData * align(EMData * this_img, EMData * to_img,
01124                                                 const string & cmp_name, const Dict& cmp_params) const;
01125                 virtual EMData * align(EMData * this_img, EMData * to_img) const
01126                 {
01127                         return align(this_img, to_img, "sqeuclidean", Dict());
01128                 }
01129                 virtual string get_name() const
01130                 {
01131                         return NAME;
01132                 }
01133 
01134                 virtual string get_desc() const
01135                 {
01136                         return "Experimental full 2D alignment with handedness check using more exhaustive search (not necessarily better than RTFBest)";
01137                 }
01138 
01139                 static Aligner *NEW()
01140                 {
01141                         return new RTFSlowExhaustiveAligner();
01142                 }
01143 
01144                 virtual TypeDict get_param_types() const
01145                 {
01146                         TypeDict d;
01147                         d.put("flip", EMObject::EMDATA,"Optional. This is the flipped version of the images that is being aligned. If specified it will be used for the handedness check, if not a flipped copy of the image will be made");
01148                         d.put("maxshift", EMObject::INT,"The maximum length of the detectable translational shift");
01149                         d.put("transtep", EMObject::FLOAT,"The translation step to take when honing the alignment, which occurs after coarse alignment");
01150                         d.put("angstep", EMObject::FLOAT,"The angular step (in degrees) to take in the exhaustive search for the solution angle. Typically very small i.e. 3 or smaller.");
01151                         return d;
01152                 }
01153                 
01154                 static const string NAME;
01155         };
01156         
01164         class SymAlignProcessor:public Aligner
01165         {
01166                 public:
01167                         virtual EMData * align(EMData * this_img, EMData * to_img, const string & cmp_name="ccc", const Dict& cmp_params = Dict()) const;
01168 
01169                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01170                         {
01171                                 return align(this_img, to_img, "ccc", Dict());
01172                         }
01173                         virtual string get_name() const
01174                         {
01175                                 return NAME;
01176                         }
01177 
01178                         static Aligner *NEW()
01179                         {
01180                                 return new SymAlignProcessor();
01181                         }
01182 
01183                         virtual TypeDict get_param_types() const
01184                         {
01185                                 TypeDict d;
01186                                 d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" );
01187                                 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
01188                                 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01189                                 d.put("lphi", EMObject::FLOAT,"Lower bound for phi. Default it 0");
01190                                 d.put("uphi", EMObject::FLOAT,"Upper bound for phi. Default it 359.9");
01191                                 d.put("avger", EMObject::STRING, "The sort of averager to use, Default=mean" );
01192                                 return d;
01193                         }
01194 
01195                         virtual string get_desc() const
01196                         {
01197                                 return "The image is centered and rotated to the standard orientation for the specified symmetry";
01198                         }
01199 
01200                         static const string NAME;
01201 
01202         };
01203 
01206         class RefineAligner:public Aligner
01207         {
01208           public:
01209                 virtual EMData * align(EMData * this_img, EMData * to_img,
01210                                            const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01211 
01212                 virtual EMData * align(EMData * this_img, EMData * to_img) const
01213                 {
01214                         return align(this_img, to_img, "sqeuclidean", Dict());
01215                 }
01216 
01217                 virtual string get_name() const
01218                 {
01219                         return NAME;
01220                 }
01221 
01222                 virtual string get_desc() const
01223                 {
01224                         return "Refines a preliminary 2D alignment using a simplex algorithm. Subpixel precision.";
01225                 }
01226 
01227                 static Aligner *NEW()
01228                 {
01229                         return new RefineAligner();
01230                 }
01231 
01232                 virtual TypeDict get_param_types() const
01233                 {
01234                         TypeDict d;
01235 
01236                         d.put("mode", EMObject::INT, "Currently unused");
01237                         d.put("xform.align2d", EMObject::TRANSFORM, "The Transform storing the starting guess. If unspecified the identity matrix is used");
01238                         d.put("stepx", EMObject::FLOAT, "The x increment used to create the starting simplex. Default is 1");
01239                         d.put("stepy", EMObject::FLOAT, "The y increment used to create the starting simplex. Default is 1");
01240                         d.put("stepaz", EMObject::FLOAT, "The rotational increment used to create the starting simplex. Default is 5");
01241                         d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.04.");
01242                         d.put("maxiter", EMObject::INT,"The maximum number of iterations that can be performed by the Simplex minimizer");
01243                         d.put("maxshift", EMObject::INT,"Maximum translation in pixels in any direction. If the solution yields a shift beyond this value in any direction, then the refinement is judged a failure and the original alignment is used as the solution.");
01244                         d.put("stepscale", EMObject::FLOAT, "If set to any non-zero value, scale will be included in the alignment, and this will be the initial step. Images should be edgenormalized. If the scale goes beyond +-30% alignment will fail.");
01245                         return d;
01246                 }
01247                 
01248                 static const string NAME;
01249         };
01250 
01257         class SymAlignProcessorQuat : public Aligner
01258         {
01259                 public:
01260                         virtual EMData * align(EMData * this_img, EMData * to_img,
01261                                                    const string & cmp_name="ccc", const Dict& cmp_params = Dict()) const;
01262 
01263                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01264                         {
01265                                 return align(this_img, to_img, "ccc", Dict());
01266                         }
01267                 
01268                 virtual string get_name() const
01269                 {
01270                         return NAME;
01271                 }
01272                 static Aligner *NEW()
01273                 {
01274                         return new SymAlignProcessorQuat();
01275                 }
01276                 string get_desc() const
01277                 {
01278                         return "Finds the symmetry axis using the simplex algorithm.";
01279                 }
01280                 virtual TypeDict get_param_types() const
01281                 {
01282                         TypeDict d;
01283                         d.put("sym", EMObject::STRING, "The symmettry. Default is c1");
01284                         d.put("xform.align3d", EMObject::TRANSFORM, "The initial guess for to align the particel to sym axis");
01285                         d.put("stepx", EMObject::FLOAT, "The initial simplex step size in x. Default is 1");
01286                         d.put("stepy", EMObject::FLOAT, "The initial simplex step size in y. Default is 1");
01287                         d.put("stepz", EMObject::FLOAT, "The initial simplex step size in z. Default is 1." );
01288                         d.put("stepn0", EMObject::FLOAT, "The initial simplex step size in the first quaternion vecotr component. Default is 1." );
01289                         d.put("stepn1", EMObject::FLOAT, "The initial simplex step size in the second quaternion vecotr component. Default is 1." );
01290                         d.put("stepn2", EMObject::FLOAT, "The initial simplex step size in the third quaternion vecotr component. Default is 1." );
01291                         d.put("spin_coeff", EMObject::FLOAT,"The multiplier appied to the spin (if it is too small or too large the simplex will not converge).  Default is 10.");
01292                         d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.01." );
01293                         d.put("maxiter", EMObject::INT, "The maximum number of iterations that can be performed by the Simplex minimizer. Default is 100.");
01294                         d.put("maxshift", EMObject::INT,"Maximum translation in pixels in any direction. If the solution yields a shift beyond this value in any direction, then the refinement is judged a failure and the original alignment is used as the solution.");
01295                         return d;
01296                 }
01297                 static const string NAME;       
01298         };
01299         
01318         class Refine3DAlignerGrid:public Aligner
01319         {
01320                 public:
01321                         virtual EMData * align(EMData * this_img, EMData * to_img,
01322                                                    const string & cmp_name="sqeuclidean", const Dict& cmp_params = Dict()) const;
01323 
01324                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01325                         {
01326                                 return align(this_img, to_img, "sqeuclidean", Dict());
01327                         }
01328 
01329                         virtual string get_name() const
01330                         {
01331                                 return NAME;
01332                         }
01333 
01334                         virtual string get_desc() const
01335                         {
01336                                 return "Refines a preliminary 3D alignment using a simplex algorithm. Subpixel precision.";
01337                         }
01338 
01339                         static Aligner *NEW()
01340                         {
01341                                 return new Refine3DAlignerGrid();
01342                         }
01343 
01344                         virtual TypeDict get_param_types() const
01345                         {
01346                                 TypeDict d;
01347                                 d.put("xform.align3d", EMObject::TRANSFORM,"The Transform storing the starting guess. If unspecified the identity matrix is used");
01348                                 d.put("delta", EMObject::FLOAT, "The angular step size. Default is 1." );
01349                                 d.put("range", EMObject::FLOAT, "The angular range size. Default is 10." );
01350                                 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01351                                 d.put("fsrotate", EMObject::BOOL,"Do rotations in Fourier space");
01352                                 d.put("search", EMObject::INT,"The maximum length of the detectable translational shift - if you supply this parameter you can not supply the maxshiftx, maxshifty or maxshiftz parameters. Each approach is mutually exclusive.");
01353                                 d.put("searchx", EMObject::INT,"The maximum length of the detectable translational shift in the x direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3.");
01354                                 d.put("searchy", EMObject::INT,"The maximum length of the detectable translational shift in the y direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3.");
01355                                 d.put("searchz", EMObject::INT,"The maximum length of the detectable translational shift in the z direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3");
01356                                 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01357                                 return d;
01358                         }
01359                         
01360                         static const string NAME;
01361         };
01362         
01384         class Refine3DAlignerQuaternion:public Aligner
01385         {
01386                 public:
01387                         virtual EMData * align(EMData * this_img, EMData * to_img,
01388                                                    const string & cmp_name="sqeuclidean", const Dict& cmp_params = Dict()) const;
01389 
01390                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01391                         {
01392                                 return align(this_img, to_img, "sqeuclidean", Dict());
01393                         }
01394 
01395                         virtual string get_name() const
01396                         {
01397                                 return NAME;
01398                         }
01399 
01400                         virtual string get_desc() const
01401                         {
01402                                 return "Refines a preliminary 3D alignment using a simplex algorithm. Subpixel precision.";
01403                         }
01404 
01405                         static Aligner *NEW()
01406                         {
01407                                 return new Refine3DAlignerQuaternion();
01408                         }
01409 
01410                         virtual TypeDict get_param_types() const
01411                         {
01412                                 TypeDict d;
01413                                 d.put("xform.align3d", EMObject::TRANSFORM,"The Transform storing the starting guess. If unspecified the identity matrix is used");
01414                                 d.put("stepx", EMObject::FLOAT, "The initial simplex step size in x. Default is 1");
01415                                 d.put("stepy", EMObject::FLOAT, "The initial simplex step size in y. Default is 1");
01416                                 d.put("stepz", EMObject::FLOAT, "The initial simplex step size in z. Default is 1." );
01417                                 d.put("stepn0", EMObject::FLOAT, "The initial simplex step size in the first quaternion vecotr component. Default is 1." );
01418                                 d.put("stepn1", EMObject::FLOAT, "The initial simplex step size in the second quaternion vecotr component. Default is 1." );
01419                                 d.put("stepn2", EMObject::FLOAT, "The initial simplex step size in the third quaternion vecotr component. Default is 1." );
01420                                 d.put("spin_coeff", EMObject::FLOAT,"The multiplier appied to the spin (if it is too small or too large the simplex will not converge).  Default is 10.");
01421                                 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.01." );
01422                                 d.put("maxiter", EMObject::INT, "The maximum number of iterations that can be performed by the Simplex minimizer. Default is 100.");
01423                                 d.put("maxshift", EMObject::INT,"Maximum translation in pixels in any direction. If the solution yields a shift beyond this value in any direction, then the refinement is judged a failure and the original alignment is used as the solution.");
01424                                 return d;
01425                         }
01426                         
01427                         static const string NAME;
01428         };
01429         
01453         class RT3DGridAligner:public Aligner
01454         {
01455                 public:
01458                         virtual EMData * align(EMData * this_img, EMData * to_img,
01459                                                    const string & cmp_name="ccc.tomo", const Dict& cmp_params = Dict()) const;
01462                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01463                         {
01464                                 return align(this_img, to_img, "ccc.tomo", Dict());
01465                         }
01466 
01467 
01470                         virtual vector<Dict> xform_align_nbest(EMData * this_img, EMData * to_img, const unsigned int nsoln, const string & cmp_name, const Dict& cmp_params) const;
01471 
01472                         virtual string get_name() const
01473                         {
01474                                 return NAME;
01475                         }
01476 
01477                         virtual string get_desc() const
01478                         {
01479                                 return "3D rotational and translational alignment using specified ranges and maximum shifts";
01480                         }
01481 
01482                         static Aligner *NEW()
01483                         {
01484                                 return new RT3DGridAligner();
01485                         }
01486 
01487                         virtual TypeDict get_param_types() const
01488                         {
01489                                 TypeDict d;
01490                                 d.put("daz", EMObject::FLOAT,"The angle increment in the azimuth direction. Default is 10");
01491                                 d.put("az0", EMObject::FLOAT,"Lower bound for the azimuth direction. Default it 0");
01492                                 d.put("az1", EMObject::FLOAT,"Upper bound for the azimuth direction. Default it 180.0");
01493                                 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01494                                 d.put("phi0", EMObject::FLOAT,"Lower bound for the phi direction. Default it 0");
01495                                 d.put("phi1", EMObject::FLOAT,"Upper bound for the phi direction. Default it 360.0");
01496                                 d.put("dalt", EMObject::FLOAT,"The angle increment in the altitude direction. Default is 10");
01497                                 d.put("alt0", EMObject::FLOAT,"Lower bound for the altitude direction. Default it 0");
01498                                 d.put("alt1", EMObject::FLOAT,"Upper bound for the altitude direction. Default it 360.0");
01499                                 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01500                                 d.put("search", EMObject::INT,"The maximum length of the detectable translational shift - if you supply this parameter you can not supply the maxshiftx, maxshifty or maxshiftz parameters. Each approach is mutually exclusive.");
01501                                 d.put("searchx", EMObject::INT,"The maximum length of the detectable translational shift in the x direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3.");
01502                                 d.put("searchy", EMObject::INT,"The maximum length of the detectable translational shift in the y direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3.");
01503                                 d.put("searchz", EMObject::INT,"The maximum length of the detectable translational shift in the z direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3");
01504                                 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01505                                 return d;
01506                         }
01507                         
01508                         static const string NAME;
01509         };
01510 
01536         class RT3DSphereAligner:public Aligner
01537         {
01538                 public:
01541                         virtual EMData * align(EMData * this_img, EMData * to_img,
01542                                                                    const string & cmp_name= "sqeuclidean", const Dict& cmp_params = Dict()) const;
01545                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01546                         {
01547                                 return align(this_img, to_img, "sqeuclidean", Dict());
01548                         }
01549 
01550 
01553                         virtual vector<Dict> xform_align_nbest(EMData * this_img, EMData * to_img, const unsigned int nsoln, const string & cmp_name, const Dict& cmp_params) const;
01554 
01555                         virtual string get_name() const
01556                         {
01557                                 return NAME;
01558                         }
01559 
01560                         virtual string get_desc() const
01561                         {
01562                                 return "3D rotational and translational alignment using spherical sampling. Can reduce the search space if symmetry is supplied";
01563                         }
01564 
01565                         static Aligner *NEW()
01566                         {
01567                                 return new RT3DSphereAligner();
01568                         }
01569 
01570                         virtual TypeDict get_param_types() const
01571                         {
01572                                 TypeDict d;
01573                                 d.put("sym", EMObject::STRING,"The symmtery to use as the basis of the spherical sampling. Default is c1 (asymmetry).");
01574                                 d.put("orientgen", EMObject::STRING,"Advanced. The orientation generation strategy. Default is eman");
01575                                 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
01576                                 d.put("n", EMObject::INT,"An alternative to the delta argument, this is the number of points you want generated on the sphere. Default is OFF");
01577                                 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01578                                 d.put("phi0", EMObject::FLOAT,"Lower bound for phi. Default it 0");
01579                                 d.put("phi1", EMObject::FLOAT,"Upper bound for phi. Default it 360");
01580                                 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01581                                 d.put("fsrotate", EMObject::BOOL,"Do rotations in Fourier space");
01582                                 d.put("search", EMObject::INT,"The maximum length of the detectable translational shift - if you supply this parameter you can not supply the maxshiftx, maxshifty or maxshiftz parameters. Each approach is mutually exclusive.");
01583                                 d.put("searchx", EMObject::INT,"The maximum length of the detectable translational shift in the x direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3.");
01584                                 d.put("searchy", EMObject::INT,"The maximum length of the detectable translational shift in the y direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3.");
01585                                 d.put("searchz", EMObject::INT,"The maximum length of the detectable translational shift in the z direction- if you supply this parameter you can not supply the maxshift parameters. Default is 3");
01586                                 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01587                                 return d;
01588                         }
01589                         
01590                         static const string NAME;
01591         };
01592         
01604         class RT3DSymmetryAligner:public Aligner
01605         {
01606                 public:
01609                         virtual EMData * align(EMData * this_img, EMData * to_img,
01610                                                    const string & cmp_name="ccc.tomo", const Dict& cmp_params = Dict()) const;
01613                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01614                         {
01615                                 return align(this_img, to_img, "ccc.tomo", Dict());
01616                         }
01617 
01618 
01621                         virtual vector<Dict> xform_align_nbest(EMData * this_img, EMData * to_img, const unsigned int nsoln, const string & cmp_name, const Dict& cmp_params) const;
01622 
01623                         virtual string get_name() const
01624                         {
01625                                 return NAME;
01626                         }
01627 
01628                         virtual string get_desc() const
01629                         {
01630                                 return "3D symmetry aligner";
01631                         }
01632 
01633                         static Aligner *NEW()
01634                         {
01635                                 return new RT3DSymmetryAligner();
01636                         }
01637 
01638                         virtual TypeDict get_param_types() const
01639                         {
01640                                 TypeDict d;
01641                                 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos");
01642                                 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis");
01643                                 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01644                                 return d;
01645                         }
01646                         
01647                         static const string NAME;
01648         };
01649 
01650         class FRM2DAligner:public Aligner
01651                         {
01652                                 public:
01653                                         virtual EMData * align(EMData * this_img, EMData * to_img,
01654                                                         const string& cmp_name, const Dict& cmp_params=Dict()) const; //ming add ="frc"
01655 
01656                                         virtual EMData * align(EMData * this_img, EMData * to_img) const
01657                                         {
01658                                                 return align(this_img, to_img, "frc", Dict());
01659                                         }
01660 
01661                                         string get_name() const
01662                                         {
01663                                                 return NAME;
01664                                         }
01665 
01666                                         string get_desc() const
01667                                         {
01668                                                 return "FRM2D uses two rotational parameters and one translational parameter";
01669                                         }
01670 
01671                                         static Aligner *NEW()
01672                                         {
01673                                                 return new FRM2DAligner();
01674                                         }
01675                                         virtual TypeDict get_param_types() const
01676                                         {
01677                                                         TypeDict d;
01678                                                         d.put("maxshift", EMObject::INT,"Maximum translation in pixels in any direction. If the solution yields a shift beyond this value in any direction, then the refinement is judged a failure and the original alignment is used as the solution.");
01679 
01680                                                         //d.put("p_max", EMObject::FLOAT,"p_max is");
01681                                                         return d;
01682                                         }
01683 
01684                                         static const string NAME;
01685                 };
01686 
01687         
01688         class CUDA_Aligner
01689         {
01690           public:
01691                 CUDA_Aligner(int id);
01692 
01693                 void finish();
01694 
01695                 void setup(int nima, int nx, int ny, int ring_length, int nring, int ou, float step, int kx, int ky, bool ctf);
01696 
01697                 void insert_image(EMData *image, int num);
01698 
01699                 void filter_stack(vector<float> ctf_params);
01700                 
01701                 void sum_oe(vector<float> ctf_params, vector<float> ali_params, EMData* ave1, EMData *ave2);
01702 
01703                 vector<float> alignment_2d(EMData *ref_image, vector<float> sx, vector<float> sy, int silent);
01704 
01705                 vector<float> ali2d_single_iter(EMData *ref_image, vector<float> ali_params, float csx, float csy, int silent, float delta);
01706 
01707           private:
01708                 float *image_stack, *image_stack_filtered;
01709                 float *ccf;
01710                 int NIMA, NX, NY, RING_LENGTH, NRING, OU, KX, KY;
01711                 bool CTF;
01712                 float STEP;
01713         };
01714 
01715         class CUDA_multiref_aligner
01716         {
01717           public:
01718                 CUDA_multiref_aligner(int id);
01719 
01720                 void finish();
01721 
01722                 void setup(int nima, int nref, int nx, int ny, int ring_length, int nring, int ou, float step, int kx, int ky, bool ctf);
01723                 
01724                 void setup_params(vector<float> all_ali_params, vector<float> all_ctf_params);
01725 
01726                 void insert_image(EMData *image, int num);
01727                 
01728                 void insert_ref_image(EMData *image, int num);
01729 
01730                 vector<float> multiref_ali2d(int silent);
01731 
01732           private:
01733                 float *image_stack, *ref_image_stack, *ref_image_stack_filtered;
01734                 float *ccf;
01735                 float *ali_params, *ctf_params;
01736                 int NIMA, NREF, NX, NY, RING_LENGTH, NRING, OU, KX, KY, MAX_IMAGE_BATCH;
01737                 bool CTF;
01738                 float STEP;
01739         };
01740 
01741         template <> Factory < Aligner >::Factory();
01742 
01743         void dump_aligners();
01744         map<string, vector<string> > dump_aligners_list();
01745 }
01746 
01747 #endif

Generated on Thu May 3 10:06:23 2012 for EMAN2 by  doxygen 1.4.7