00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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
00147
00148
00149
00150 protected:
00151 mutable Dict params;
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
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 = 2);
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
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
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
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
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
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
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
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
01215 class RefineAligner:public Aligner
01216 {
01217 public:
01218 virtual EMData * align(EMData * this_img, EMData * to_img,
01219 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01220
01221 virtual EMData * align(EMData * this_img, EMData * to_img) const
01222 {
01223 return align(this_img, to_img, "sqeuclidean", Dict());
01224 }
01225
01226 virtual string get_name() const
01227 {
01228 return NAME;
01229 }
01230
01231 virtual string get_desc() const
01232 {
01233 return "Refines a preliminary 2D alignment using a simplex algorithm. Subpixel precision.";
01234 }
01235
01236 static Aligner *NEW()
01237 {
01238 return new RefineAligner();
01239 }
01240
01241 virtual TypeDict get_param_types() const
01242 {
01243 TypeDict d;
01244
01245 d.put("mode", EMObject::INT, "Currently unused");
01246 d.put("xform.align2d", EMObject::TRANSFORM, "The Transform storing the starting guess. If unspecified the identity matrix is used");
01247 d.put("stepx", EMObject::FLOAT, "The x increment used to create the starting simplex. Default is 1");
01248 d.put("stepy", EMObject::FLOAT, "The y increment used to create the starting simplex. Default is 1");
01249 d.put("stepaz", EMObject::FLOAT, "The rotational increment used to create the starting simplex. Default is 5");
01250 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.04.");
01251 d.put("maxiter", EMObject::INT,"The maximum number of iterations that can be performed by the Simplex minimizer. default=28");
01252 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.");
01253 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.");
01254 d.put("mask", EMObject::EMDATA, "A mask to be applied to the image being aligned prior to each similarity comparison.");
01255 d.put("verbose", EMObject::INT, "This will cause debugging information to be printed on the screen for the iterative refinement. Larger numbers -> more info. default=0");
01256 return d;
01257 }
01258
01259 static const string NAME;
01260 };
01261
01262
01272 class RefineAlignerCG:public Aligner
01273 {
01274 public:
01275 virtual EMData * align(EMData * this_img, EMData * to_img,
01276 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01277
01278 virtual EMData * align(EMData * this_img, EMData * to_img) const
01279 {
01280 return align(this_img, to_img, "sqeuclidean", Dict());
01281 }
01282
01283 virtual string get_name() const
01284 {
01285 return NAME;
01286 }
01287
01288 virtual string get_desc() const
01289 {
01290 return "Refines a preliminary 2D alignment using a simplex algorithm. Subpixel precision.";
01291 }
01292
01293 static Aligner *NEW()
01294 {
01295 return new RefineAlignerCG();
01296 }
01297
01298 virtual TypeDict get_param_types() const
01299 {
01300 TypeDict d;
01301
01302 d.put("mode", EMObject::INT, "Currently unused");
01303 d.put("xform.align2d", EMObject::TRANSFORM, "The Transform storing the starting guess. If unspecified the identity matrix is used");
01304 d.put("step", EMObject::FLOAT, "The x increment used to create the starting simplex. Default is 0.1");
01305 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.02.");
01306 d.put("maxiter", EMObject::INT,"The maximum number of iterations that can be performed by the Simplex minimizer. default=12");
01307 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.");
01308 d.put("stepscale", EMObject::FLOAT, "If set to any non-zero value, scale will be included in the alignment. Images should be edgenormalized. If the scale goes beyond +-30% alignment will fail.");
01309 d.put("mask", EMObject::EMDATA, "A mask to be applied to the image being aligned prior to each similarity comparison.");
01310 d.put("verbose", EMObject::INT, "This will cause debugging information to be printed on the screen for the iterative refinement. Larger numbers -> more info. default=0");
01311 return d;
01312 }
01313
01314 static const string NAME;
01315 };
01316
01323 class SymAlignProcessorQuat : public Aligner
01324 {
01325 public:
01326 virtual EMData * align(EMData * this_img, EMData * to_img,
01327 const string & cmp_name="ccc", const Dict& cmp_params = Dict()) const;
01328
01329 virtual EMData * align(EMData * this_img, EMData * to_img) const
01330 {
01331 return align(this_img, to_img, "ccc", Dict());
01332 }
01333
01334 virtual string get_name() const
01335 {
01336 return NAME;
01337 }
01338 static Aligner *NEW()
01339 {
01340 return new SymAlignProcessorQuat();
01341 }
01342 string get_desc() const
01343 {
01344 return "Finds the symmetry axis using the simplex algorithm.";
01345 }
01346 virtual TypeDict get_param_types() const
01347 {
01348 TypeDict d;
01349 d.put("sym", EMObject::STRING, "The symmettry. Default is c1");
01350 d.put("xform.align3d", EMObject::TRANSFORM, "The initial guess for to align the particel to sym axis");
01351 d.put("stepx", EMObject::FLOAT, "The initial simplex step size in x. Default is 1");
01352 d.put("stepy", EMObject::FLOAT, "The initial simplex step size in y. Default is 1");
01353 d.put("stepz", EMObject::FLOAT, "The initial simplex step size in z. Default is 1." );
01354 d.put("stepn0", EMObject::FLOAT, "The initial simplex step size in the first quaternion vecotr component. Default is 1." );
01355 d.put("stepn1", EMObject::FLOAT, "The initial simplex step size in the second quaternion vecotr component. Default is 1." );
01356 d.put("stepn2", EMObject::FLOAT, "The initial simplex step size in the third quaternion vecotr component. Default is 1." );
01357 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.");
01358 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.01." );
01359 d.put("maxiter", EMObject::INT, "The maximum number of iterations that can be performed by the Simplex minimizer. Default is 100.");
01360 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.");
01361 return d;
01362 }
01363 static const string NAME;
01364 };
01365
01384 class Refine3DAlignerGrid: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 Refine3DAlignerGrid();
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("delta", EMObject::FLOAT, "The angular step size. Default is 1." );
01415 d.put("range", EMObject::FLOAT, "The angular range size. Default is 10." );
01416 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01417 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.");
01418 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.");
01419 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.");
01420 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");
01421 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01422 return d;
01423 }
01424
01425 static const string NAME;
01426 };
01427
01449 class Refine3DAlignerQuaternion:public Aligner
01450 {
01451 public:
01452 virtual EMData * align(EMData * this_img, EMData * to_img,
01453 const string & cmp_name="sqeuclidean", const Dict& cmp_params = Dict()) const;
01454
01455 virtual EMData * align(EMData * this_img, EMData * to_img) const
01456 {
01457 return align(this_img, to_img, "sqeuclidean", Dict());
01458 }
01459
01460 virtual string get_name() const
01461 {
01462 return NAME;
01463 }
01464
01465 virtual string get_desc() const
01466 {
01467 return "Refines a preliminary 3D alignment using a simplex algorithm. Subpixel precision.";
01468 }
01469
01470 static Aligner *NEW()
01471 {
01472 return new Refine3DAlignerQuaternion();
01473 }
01474
01475 virtual TypeDict get_param_types() const
01476 {
01477 TypeDict d;
01478 d.put("xform.align3d", EMObject::TRANSFORM,"The Transform storing the starting guess. If unspecified the identity matrix is used");
01479 d.put("stepx", EMObject::FLOAT, "The initial simplex step size in x. Default is 1");
01480 d.put("stepy", EMObject::FLOAT, "The initial simplex step size in y. Default is 1");
01481 d.put("stepz", EMObject::FLOAT, "The initial simplex step size in z. Default is 1." );
01482 d.put("stepn0", EMObject::FLOAT, "The initial simplex step size in the first quaternion vecotr component. Default is 1." );
01483 d.put("stepn1", EMObject::FLOAT, "The initial simplex step size in the second quaternion vecotr component. Default is 1." );
01484 d.put("stepn2", EMObject::FLOAT, "The initial simplex step size in the third quaternion vecotr component. Default is 1." );
01485 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.");
01486 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.01." );
01487 d.put("maxiter", EMObject::INT, "The maximum number of iterations that can be performed by the Simplex minimizer. Default is 100.");
01488 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.");
01489 return d;
01490 }
01491
01492 static const string NAME;
01493 };
01494
01518 class RT3DGridAligner:public Aligner
01519 {
01520 public:
01523 virtual EMData * align(EMData * this_img, EMData * to_img,
01524 const string & cmp_name="ccc.tomo", const Dict& cmp_params = Dict()) const;
01527 virtual EMData * align(EMData * this_img, EMData * to_img) const
01528 {
01529 return align(this_img, to_img, "ccc.tomo", Dict());
01530 }
01531
01532
01535 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;
01536
01537 virtual string get_name() const
01538 {
01539 return NAME;
01540 }
01541
01542 virtual string get_desc() const
01543 {
01544 return "3D rotational and translational alignment using specified ranges and maximum shifts";
01545 }
01546
01547 static Aligner *NEW()
01548 {
01549 return new RT3DGridAligner();
01550 }
01551
01552 virtual TypeDict get_param_types() const
01553 {
01554 TypeDict d;
01555 d.put("daz", EMObject::FLOAT,"The angle increment in the azimuth direction. Default is 10");
01556 d.put("az0", EMObject::FLOAT,"Lower bound for the azimuth direction. Default it 0");
01557 d.put("az1", EMObject::FLOAT,"Upper bound for the azimuth direction. Default it 180.0");
01558 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01559 d.put("phi0", EMObject::FLOAT,"Lower bound for the phi direction. Default it 0");
01560 d.put("phi1", EMObject::FLOAT,"Upper bound for the phi direction. Default it 360.0");
01561 d.put("dalt", EMObject::FLOAT,"The angle increment in the altitude direction. Default is 10");
01562 d.put("alt0", EMObject::FLOAT,"Lower bound for the altitude direction. Default it 0");
01563 d.put("alt1", EMObject::FLOAT,"Upper bound for the altitude direction. Default it 360.0");
01564 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01565 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.");
01566 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.");
01567 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.");
01568 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");
01569 d.put("initxform", EMObject::TRANSFORM,"The Transform storing the starting position. If unspecified the identity matrix is used");
01570 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01571 return d;
01572 }
01573
01574 static const string NAME;
01575 };
01576
01602 class RT3DSphereAligner:public Aligner
01603 {
01604 public:
01607 virtual EMData * align(EMData * this_img, EMData * to_img,
01608 const string & cmp_name= "sqeuclidean", const Dict& cmp_params = Dict()) const;
01611 virtual EMData * align(EMData * this_img, EMData * to_img) const
01612 {
01613 return align(this_img, to_img, "sqeuclidean", Dict());
01614 }
01615
01616
01619 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;
01620
01621 virtual string get_name() const
01622 {
01623 return NAME;
01624 }
01625
01626 virtual string get_desc() const
01627 {
01628 return "3D rotational and translational alignment using spherical sampling. Can reduce the search space if symmetry is supplied";
01629 }
01630
01631 static Aligner *NEW()
01632 {
01633 return new RT3DSphereAligner();
01634 }
01635
01636 virtual TypeDict get_param_types() const
01637 {
01638 TypeDict d;
01639 d.put("sym", EMObject::STRING,"The symmtery to use as the basis of the spherical sampling. Default is c1 (asymmetry).");
01640 d.put("orientgen", EMObject::STRING,"Advanced. The orientation generation strategy. Default is eman");
01641 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
01642 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");
01643 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01644 d.put("phi0", EMObject::FLOAT,"Lower bound for phi. Default it 0");
01645 d.put("phi1", EMObject::FLOAT,"Upper bound for phi. Default it 360");
01646 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01647 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.");
01648 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.");
01649 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.");
01650 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");
01651 d.put("initxform", EMObject::TRANSFORM,"The Transform storing the starting position. If unspecified the identity matrix is used");
01652 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01653 return d;
01654 }
01655
01656 static const string NAME;
01657 };
01658
01670 class RT3DSymmetryAligner:public Aligner
01671 {
01672 public:
01675 virtual EMData * align(EMData * this_img, EMData * to_img,
01676 const string & cmp_name="ccc.tomo", const Dict& cmp_params = Dict()) const;
01679 virtual EMData * align(EMData * this_img, EMData * to_img) const
01680 {
01681 return align(this_img, to_img, "ccc.tomo", Dict());
01682 }
01683
01684
01687 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;
01688
01689 virtual string get_name() const
01690 {
01691 return NAME;
01692 }
01693
01694 virtual string get_desc() const
01695 {
01696 return "3D symmetry aligner";
01697 }
01698
01699 static Aligner *NEW()
01700 {
01701 return new RT3DSymmetryAligner();
01702 }
01703
01704 virtual TypeDict get_param_types() const
01705 {
01706 TypeDict d;
01707 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos");
01708 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis");
01709 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01710 return d;
01711 }
01712
01713 static const string NAME;
01714 };
01715
01716 class FRM2DAligner:public Aligner
01717 {
01718 public:
01719 virtual EMData * align(EMData * this_img, EMData * to_img,
01720 const string& cmp_name, const Dict& cmp_params=Dict()) const;
01721
01722 virtual EMData * align(EMData * this_img, EMData * to_img) const
01723 {
01724 return align(this_img, to_img, "frc", Dict());
01725 }
01726
01727 string get_name() const
01728 {
01729 return NAME;
01730 }
01731
01732 string get_desc() const
01733 {
01734 return "FRM2D uses two rotational parameters and one translational parameter";
01735 }
01736
01737 static Aligner *NEW()
01738 {
01739 return new FRM2DAligner();
01740 }
01741 virtual TypeDict get_param_types() const
01742 {
01743 TypeDict d;
01744 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.");
01745
01746
01747 return d;
01748 }
01749
01750 static const string NAME;
01751 };
01752
01753
01754 class CUDA_Aligner
01755 {
01756 public:
01757 CUDA_Aligner(int id);
01758
01759 void finish();
01760
01761 void setup(int nima, int nx, int ny, int ring_length, int nring, int ou, float step, int kx, int ky, bool ctf);
01762
01763 void insert_image(EMData *image, int num);
01764
01765 void filter_stack(vector<float> ctf_params);
01766
01767 void sum_oe(vector<float> ctf_params, vector<float> ali_params, EMData* ave1, EMData *ave2);
01768
01769 vector<float> alignment_2d(EMData *ref_image, vector<float> sx, vector<float> sy, int silent);
01770
01771 vector<float> ali2d_single_iter(EMData *ref_image, vector<float> ali_params, float csx, float csy, int silent, float delta);
01772
01773 private:
01774 float *image_stack, *image_stack_filtered;
01775 float *ccf;
01776 int NIMA, NX, NY, RING_LENGTH, NRING, OU, KX, KY;
01777 bool CTF;
01778 float STEP;
01779 };
01780
01781 class CUDA_multiref_aligner
01782 {
01783 public:
01784 CUDA_multiref_aligner(int id);
01785
01786 void finish();
01787
01788 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);
01789
01790 void setup_params(vector<float> all_ali_params, vector<float> all_ctf_params);
01791
01792 void insert_image(EMData *image, int num);
01793
01794 void insert_ref_image(EMData *image, int num);
01795
01796 vector<float> multiref_ali2d(int silent);
01797
01798 private:
01799 float *image_stack, *ref_image_stack, *ref_image_stack_filtered;
01800 float *ccf;
01801 float *ali_params, *ctf_params;
01802 int NIMA, NREF, NX, NY, RING_LENGTH, NRING, OU, KX, KY, MAX_IMAGE_BATCH;
01803 bool CTF;
01804 float STEP;
01805 };
01806
01807 template <> Factory < Aligner >::Factory();
01808
01809 void dump_aligners();
01810 map<string, vector<string> > dump_aligners_list();
01811 }
01812
01813 #endif