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, even on poorly centered images, but leaves a 180 degree ambiguity which requires a translational alignment to resolve. Usually called internally by rotate_translate aligner.";
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,int zscore=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 d.put("zscore", EMObject::INT,"Either 0 or 1. If set, will convert per-radius CCF curves into Z-score significnace curves before averaging. In theory this should produce better results by focusing on radii with more alignment information. (default=false)");
00318 d.put("ambig180", EMObject::INT,"Either 0 or 1. If set, will not try and resolve the 180 degree ambiguity. If not set, it will assume the particle is well centered and resolve the ambiguity that way. default=false");
00319 return d;
00320 }
00321
00322 static const string NAME;
00323 };
00324
00332 class RotationalAlignerIterative:public Aligner
00333 {
00334 public:
00335 virtual EMData * align(EMData * this_img, EMData * to_img,
00336 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00337
00338 virtual EMData * align(EMData * this_img, EMData * to_img) const
00339 {
00340 return align(this_img, to_img, "dot", Dict());
00341 }
00342
00343 virtual string get_name() const
00344 {
00345 return NAME;
00346 }
00347
00348 virtual string get_desc() const
00349 {
00350 return "Performs rotational alignment using the SPIDER method";
00351 }
00352
00353 static Aligner *NEW()
00354 {
00355 return new RotationalAlignerIterative();
00356 }
00357
00358 virtual TypeDict get_param_types() const
00359 {
00360 TypeDict d;
00361 d.put("r1", EMObject::INT, "Inner ring, pixels");
00362 d.put("r2", EMObject::INT, "Outer ring, pixels");
00363 return d;
00364 }
00365
00366 static const string NAME;
00367 };
00368
00371 class RotatePrecenterAligner:public Aligner
00372 {
00373 public:
00374 virtual EMData * align(EMData * this_img, EMData * to_img,
00375 const string & cmp_name = "dot", const Dict& cmp_params = Dict()) const;
00376
00377 virtual EMData * align(EMData * this_img, EMData * to_img) const
00378 {
00379 return align(this_img, to_img, "dot", Dict());
00380 }
00381
00382 virtual string get_name() const
00383 {
00384 return NAME;
00385 }
00386
00387 virtual string get_desc() const
00388 {
00389 return "Performs rotational alignment and works accurately if the image is precentered";
00390 }
00391
00392 static Aligner *NEW()
00393 {
00394 return new RotatePrecenterAligner();
00395 }
00396
00397 virtual TypeDict get_param_types() const
00398 {
00399 TypeDict d;
00400 return d;
00401 }
00402
00403 static const string NAME;
00404 };
00405
00412 class RotateTranslateAligner:public Aligner
00413 {
00414 public:
00415 virtual EMData * align(EMData * this_img, EMData * to_img,
00416 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00417
00418 virtual EMData * align(EMData * this_img, EMData * to_img) const
00419 {
00420 return align(this_img, to_img, "sqeuclidean", Dict());
00421 }
00422
00423 virtual string get_name() const
00424 {
00425 return NAME;
00426 }
00427
00428 virtual string get_desc() const
00429 {
00430 return "Performs rotational alignment and follows this with translational alignment.";
00431 }
00432
00433 static Aligner *NEW()
00434 {
00435 return new RotateTranslateAligner();
00436 }
00437
00438 virtual TypeDict get_param_types() const
00439 {
00440 TypeDict d;
00441
00442 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00443 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00444 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00445 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00446 d.put("zscore", EMObject::INT,"Either 0 or 1. This option is passed directly to the rotational aligner (default=false)");
00447 return d;
00448 }
00449
00450 static const string NAME;
00451 };
00452
00463 class RotateTranslateScaleAligner:public ScaleAlignerABS
00464 {
00465 public:
00466
00467
00468 RotateTranslateScaleAligner() : ScaleAlignerABS("rotate_translate")
00469 {
00470 }
00471
00472 virtual EMData * align(EMData * this_img, EMData * to_img,
00473 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00474
00475 virtual EMData * align(EMData * this_img, EMData * to_img) const
00476 {
00477 return align(this_img, to_img, "sqeuclidean", Dict());
00478 }
00479
00480 virtual string get_name() const
00481 {
00482 return NAME;
00483 }
00484
00485 virtual string get_desc() const
00486 {
00487 return "Performs rotational alignment and follows this with translational and then scaling alignment.";
00488 }
00489
00490 static Aligner *NEW()
00491 {
00492 return new RotateTranslateScaleAligner();
00493 }
00494
00495 virtual TypeDict get_param_types() const
00496 {
00497 TypeDict d;
00498 d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00499 d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00500 d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00501 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00502 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00503 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00504 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00505 d.put("zscore", EMObject::INT,"Either 0 or 1. This option is passed directly to the rotational aligner (default=false)");
00506 return d;
00507 }
00508
00509 static const string NAME;
00510 };
00511
00522 class RotateTranslateAlignerIterative:public Aligner
00523 {
00524 public:
00525 virtual EMData * align(EMData * this_img, EMData * to_img,
00526 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00527
00528 virtual EMData * align(EMData * this_img, EMData * to_img) const
00529 {
00530 return align(this_img, to_img, "sqeuclidean", Dict());
00531 }
00532
00533 virtual string get_name() const
00534 {
00535 return NAME;
00536 }
00537
00538 virtual string get_desc() const
00539 {
00540 return "Performs rotational alignment and follows this with translational alignment using the iterative method.";
00541 }
00542
00543 static Aligner *NEW()
00544 {
00545 return new RotateTranslateAlignerIterative();
00546 }
00547
00548 virtual TypeDict get_param_types() const
00549 {
00550 TypeDict d;
00551 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00552 d.put("r1", EMObject::INT, "Inner ring, pixels");
00553 d.put("r2", EMObject::INT, "Outer ring, pixels");
00554 d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00555 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00556 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00557 return d;
00558 }
00559
00560 static const string NAME;
00561 };
00562
00576 class RotateTranslateScaleAlignerIterative:public ScaleAlignerABS
00577 {
00578 public:
00579
00580 RotateTranslateScaleAlignerIterative() : ScaleAlignerABS("rotate_translate_iterative")
00581 {
00582 }
00583
00584 virtual EMData * align(EMData * this_img, EMData * to_img,
00585 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00586
00587 virtual EMData * align(EMData * this_img, EMData * to_img) const
00588 {
00589 return align(this_img, to_img, "sqeuclidean", Dict());
00590 }
00591
00592 virtual string get_name() const
00593 {
00594 return NAME;
00595 }
00596
00597 virtual string get_desc() const
00598 {
00599 return "Performs rotational alignment and follows this with translational alignment using the iterative method. Does this for each scale and returns the best";
00600 }
00601
00602 static Aligner *NEW()
00603 {
00604 return new RotateTranslateScaleAlignerIterative();
00605 }
00606
00607 virtual TypeDict get_param_types() const
00608 {
00609 TypeDict d;
00610 d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00611 d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00612 d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00613 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00614 d.put("r1", EMObject::INT, "Inner ring, pixels");
00615 d.put("r2", EMObject::INT, "Outer ring, pixels");
00616 d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00617 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00618 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00619 return d;
00620 }
00621
00622 static const string NAME;
00623 };
00624
00634 class RotateTranslateAlignerPawel:public Aligner
00635 {
00636 public:
00637 virtual EMData * align(EMData * this_img, EMData * to_img,
00638 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00639
00640 virtual EMData * align(EMData * this_img, EMData * to_img) const
00641 {
00642 return align(this_img, to_img, "sqeuclidean", Dict());
00643 }
00644
00645 virtual string get_name() const
00646 {
00647 return NAME;
00648 }
00649
00650 virtual string get_desc() const
00651 {
00652 return "Performs rotational alignment and translation align by resampling to polar coordinates in real space.";
00653 }
00654
00655 static Aligner *NEW()
00656 {
00657 return new RotateTranslateAlignerPawel();
00658 }
00659
00660 virtual TypeDict get_param_types() const
00661 {
00662 TypeDict d;
00663
00664 d.put("tx", EMObject::INT, "Maximum x translation in pixels, Default = 0");
00665 d.put("ty", EMObject::INT, "Maximum y translation in pixels, Default = 0");
00666 d.put("r1", EMObject::INT, "Inner ring, pixels");
00667 d.put("r2", EMObject::INT, "Outer ring, pixels");
00668 return d;
00669 }
00670
00671 static const string NAME;
00672 };
00673
00678 class RotateTranslateBestAligner:public Aligner
00679 {
00680 public:
00681 virtual EMData * align(EMData * this_img, EMData * to_img,
00682 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00683
00684 virtual EMData * align(EMData * this_img, EMData * to_img) const
00685 {
00686 return align(this_img, to_img, "frc", Dict());
00687 }
00688
00689 virtual string get_name() const
00690 {
00691 return NAME;
00692 }
00693
00694 virtual string get_desc() const
00695 {
00696 return "Full 2D alignment using 'Rotational' and 'Translational', also incorporates 2D 'Refine' alignments.";
00697 }
00698
00699 static Aligner *NEW()
00700 {
00701 return new RotateTranslateBestAligner();
00702 }
00703
00704 virtual TypeDict get_param_types() const
00705 {
00706 TypeDict d;
00707 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00708 d.put("snr", EMObject::FLOATARRAY, "signal to noise ratio array");
00709 return d;
00710 }
00711
00712 static const string NAME;
00713 };
00714
00720 class RotateFlipAligner:public Aligner
00721 {
00722 public:
00723 virtual EMData * align(EMData * this_img, EMData * to_img,
00724 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00725 virtual EMData * align(EMData * this_img, EMData * to_img) const
00726 {
00727 return align(this_img, to_img, "dot", Dict());
00728 }
00729 virtual string get_name() const
00730 {
00731 return NAME;
00732 }
00733
00734 virtual string get_desc() const
00735 {
00736 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";
00737 }
00738
00739 static Aligner *NEW()
00740 {
00741 return new RotateFlipAligner();
00742 }
00743
00744 virtual TypeDict get_param_types() const
00745 {
00746 return static_get_param_types();
00747 }
00748
00749 static TypeDict static_get_param_types() {
00750 TypeDict d;
00751
00752 d.put("imask", EMObject::INT);
00753 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00754 return d;
00755 }
00756
00757 static const string NAME;
00758 };
00759
00766 class RotateFlipAlignerIterative:public Aligner
00767 {
00768 public:
00769 virtual EMData * align(EMData * this_img, EMData * to_img,
00770 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00771 virtual EMData * align(EMData * this_img, EMData * to_img) const
00772 {
00773 return align(this_img, to_img, "dot", Dict());
00774 }
00775 virtual string get_name() const
00776 {
00777 return NAME;
00778 }
00779
00780 virtual string get_desc() const
00781 {
00782 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";
00783 }
00784
00785 static Aligner *NEW()
00786 {
00787 return new RotateFlipAlignerIterative();
00788 }
00789
00790 virtual TypeDict get_param_types() const
00791 {
00792 return static_get_param_types();
00793 }
00794
00795 static TypeDict static_get_param_types() {
00796 TypeDict d;
00797 d.put("r1", EMObject::INT, "Inner ring, pixels");
00798 d.put("r2", EMObject::INT, "Outer ring, pixels");
00799 return d;
00800 }
00801
00802 static const string NAME;
00803 };
00804
00811 class RotateTranslateFlipAligner:public Aligner
00812 {
00813 public:
00814 virtual EMData * align(EMData * this_img, EMData * to_img,
00815 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00816 virtual EMData * align(EMData * this_img, EMData * to_img) const
00817 {
00818 return align(this_img, to_img, "sqeuclidean", Dict());
00819 }
00820
00821 virtual string get_name() const
00822 {
00823 return NAME;
00824 }
00825
00826 virtual string get_desc() const
00827 {
00828 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";
00829 }
00830
00831 static Aligner *NEW()
00832 {
00833 return new RotateTranslateFlipAligner();
00834 }
00835
00836 virtual TypeDict get_param_types() const
00837 {
00838 return static_get_param_types();
00839 }
00840
00841 static TypeDict static_get_param_types() {
00842 TypeDict d;
00843
00844 d.put("flip", EMObject::EMDATA);
00845 d.put("usedot", EMObject::INT);
00846 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00847 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00848 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00849 d.put("zscore", EMObject::INT,"Either 0 or 1. This option is passed directly to the rotational aligner (default=false)");
00850 return d;
00851 }
00852
00853 static const string NAME;
00854 };
00855
00867 class RotateTranslateFlipScaleAligner:public ScaleAlignerABS
00868 {
00869 public:
00870
00871 RotateTranslateFlipScaleAligner() : ScaleAlignerABS("rotate_translate_flip")
00872 {
00873 }
00874
00875 virtual EMData * align(EMData * this_img, EMData * to_img,
00876 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00877
00878 virtual EMData * align(EMData * this_img, EMData * to_img) const
00879 {
00880 return align(this_img, to_img, "sqeuclidean", Dict());
00881 }
00882
00883 virtual string get_name() const
00884 {
00885 return NAME;
00886 }
00887
00888 virtual string get_desc() const
00889 {
00890 return "Performs rotational alignment and follows this with translational and then scaling alignment.";
00891 }
00892
00893 static Aligner *NEW()
00894 {
00895 return new RotateTranslateFlipScaleAligner();
00896 }
00897
00898 virtual TypeDict get_param_types() const
00899 {
00900 TypeDict d;
00901 d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
00902 d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
00903 d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
00904 d.put("flip", EMObject::EMDATA);
00905 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00906 d.put("nozero", EMObject::INT,"Zero translation not permitted (useful for CCD images)");
00907 d.put("rfp_mode", EMObject::INT,"Either 0,1 or 2. A temporary flag for testing the rotational foot print");
00908 d.put("useflcf", EMObject::INT,"Use Fast Local Correlation Function rather than CCF for translational alignment");
00909 d.put("zscore", EMObject::INT,"Either 0 or 1. This option is passed directly to the rotational aligner (default=false)");
00910 return d;
00911 }
00912
00913 static const string NAME;
00914 };
00915
00925 class RotateTranslateFlipAlignerIterative:public Aligner
00926 {
00927 public:
00928 virtual EMData * align(EMData * this_img, EMData * to_img,
00929 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00930 virtual EMData * align(EMData * this_img, EMData * to_img) const
00931 {
00932 return align(this_img, to_img, "sqeuclidean", Dict());
00933 }
00934
00935 virtual string get_name() const
00936 {
00937 return NAME;
00938 }
00939
00940 virtual string get_desc() const
00941 {
00942 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";
00943 }
00944
00945 static Aligner *NEW()
00946 {
00947 return new RotateTranslateFlipAlignerIterative();
00948 }
00949
00950 virtual TypeDict get_param_types() const
00951 {
00952 return static_get_param_types();
00953 }
00954
00955 static TypeDict static_get_param_types() {
00956 TypeDict d;
00957 d.put("flip", EMObject::EMDATA);
00958 d.put("r1", EMObject::INT, "Inner ring, pixels");
00959 d.put("r2", EMObject::INT, "Outer ring, pixels");
00960 d.put("maxiter", EMObject::INT, "Maximum number of iterations");
00961 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
00962 return d;
00963 }
00964
00965 static const string NAME;
00966 };
00967
00981 class RotateTranslateFlipScaleAlignerIterative:public ScaleAlignerABS
00982 {
00983 public:
00984
00985 RotateTranslateFlipScaleAlignerIterative() : ScaleAlignerABS("rotate_translate_flip_iterative")
00986 {
00987 }
00988
00989 virtual EMData * align(EMData * this_img, EMData * to_img,
00990 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
00991
00992 virtual EMData * align(EMData * this_img, EMData * to_img) const
00993 {
00994 return align(this_img, to_img, "sqeuclidean", Dict());
00995 }
00996
00997 virtual string get_name() const
00998 {
00999 return NAME;
01000 }
01001
01002 virtual string get_desc() const
01003 {
01004 return "Performs rotational alignment and follows this with translational alignment using the iterative method. Does this for each scale and returns the best";
01005 }
01006
01007 static Aligner *NEW()
01008 {
01009 return new RotateTranslateFlipScaleAlignerIterative();
01010 }
01011
01012 virtual TypeDict get_param_types() const
01013 {
01014 TypeDict d;
01015 d.put("min", EMObject::FLOAT, "Minimum scaling (default: 0.95)");
01016 d.put("max", EMObject::FLOAT, "Maximum scaling (default: 1.05)");
01017 d.put("step", EMObject::FLOAT, "Scaling step (default: 0.01)");
01018 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
01019 d.put("flip", EMObject::EMDATA);
01020 d.put("r1", EMObject::INT, "Inner ring, pixels");
01021 d.put("r2", EMObject::INT, "Outer ring, pixels");
01022 d.put("maxiter", EMObject::INT, "Maximum number of iterations");
01023 return d;
01024 }
01025
01026 static const string NAME;
01027 };
01028
01038 class RotateTranslateFlipAlignerPawel:public Aligner
01039 {
01040 public:
01041 virtual EMData * align(EMData * this_img, EMData * to_img,
01042 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01043
01044 virtual EMData * align(EMData * this_img, EMData * to_img) const
01045 {
01046 return align(this_img, to_img, "sqeuclidean", Dict());
01047 }
01048
01049 virtual string get_name() const
01050 {
01051 return NAME;
01052 }
01053
01054 virtual string get_desc() const
01055 {
01056 return "Performs rotational alignment, translation align, and flip by resampling to polar coordinates in real space.";
01057 }
01058
01059 static Aligner *NEW()
01060 {
01061 return new RotateTranslateFlipAlignerPawel();
01062 }
01063
01064 virtual TypeDict get_param_types() const
01065 {
01066 TypeDict d;
01067
01068 d.put("tx", EMObject::INT, "Maximum x translation in pixels, Default = 0");
01069 d.put("ty", EMObject::INT, "Maximum y translation in pixels, Default = 0");
01070 d.put("r1", EMObject::INT, "Inner ring, pixels");
01071 d.put("r2", EMObject::INT, "Outer ring, pixels");
01072 return d;
01073 }
01074
01075 static const string NAME;
01076 };
01077
01082 class RTFExhaustiveAligner:public Aligner
01083 {
01084 public:
01085 virtual EMData * align(EMData * this_img, EMData * to_img,
01086 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01087 virtual EMData * align(EMData * this_img, EMData * to_img) const
01088 {
01089 return align(this_img, to_img, "sqeuclidean", Dict());
01090 }
01091
01092 virtual string get_name() const
01093 {
01094 return NAME;
01095 }
01096
01097 virtual string get_desc() const
01098 {
01099 return "Experimental full 2D alignment with handedness check using semi-exhaustive search (not necessarily better than RTFBest)";
01100 }
01101
01102 static Aligner *NEW()
01103 {
01104 return new RTFExhaustiveAligner();
01105 }
01106
01107 virtual TypeDict get_param_types() const
01108 {
01109 TypeDict d;
01110
01111 d.put("flip", EMObject::EMDATA);
01112 d.put("maxshift", EMObject::INT, "Maximum translation in pixels");
01113 return d;
01114 }
01115
01116 static const string NAME;
01117 };
01118
01126 class RTFSlowExhaustiveAligner:public Aligner
01127 {
01128 public:
01129 virtual EMData * align(EMData * this_img, EMData * to_img,
01130 const string & cmp_name, const Dict& cmp_params) const;
01131 virtual EMData * align(EMData * this_img, EMData * to_img) const
01132 {
01133 return align(this_img, to_img, "sqeuclidean", Dict());
01134 }
01135 virtual string get_name() const
01136 {
01137 return NAME;
01138 }
01139
01140 virtual string get_desc() const
01141 {
01142 return "Experimental full 2D alignment with handedness check using more exhaustive search (not necessarily better than RTFBest)";
01143 }
01144
01145 static Aligner *NEW()
01146 {
01147 return new RTFSlowExhaustiveAligner();
01148 }
01149
01150 virtual TypeDict get_param_types() const
01151 {
01152 TypeDict d;
01153 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");
01154 d.put("maxshift", EMObject::INT,"The maximum length of the detectable translational shift");
01155 d.put("transtep", EMObject::FLOAT,"The translation step to take when honing the alignment, which occurs after coarse alignment");
01156 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.");
01157 return d;
01158 }
01159
01160 static const string NAME;
01161 };
01162
01170 class SymAlignProcessor:public Aligner
01171 {
01172 public:
01173 virtual EMData * align(EMData * this_img, EMData * to_img, const string & cmp_name="ccc", const Dict& cmp_params = Dict()) const;
01174
01175 virtual EMData * align(EMData * this_img, EMData * to_img) const
01176 {
01177 return align(this_img, to_img, "ccc", Dict());
01178 }
01179 virtual string get_name() const
01180 {
01181 return NAME;
01182 }
01183
01184 static Aligner *NEW()
01185 {
01186 return new SymAlignProcessor();
01187 }
01188
01189 virtual TypeDict get_param_types() const
01190 {
01191 TypeDict d;
01192 d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" );
01193 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
01194 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01195 d.put("lphi", EMObject::FLOAT,"Lower bound for phi. Default it 0");
01196 d.put("uphi", EMObject::FLOAT,"Upper bound for phi. Default it 359.9");
01197 d.put("avger", EMObject::STRING, "The sort of averager to use, Default=mean" );
01198 return d;
01199 }
01200
01201 virtual string get_desc() const
01202 {
01203 return "The image is centered and rotated to the standard orientation for the specified symmetry";
01204 }
01205
01206 static const string NAME;
01207
01208 };
01209
01221 class RefineAligner:public Aligner
01222 {
01223 public:
01224 virtual EMData * align(EMData * this_img, EMData * to_img,
01225 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01226
01227 virtual EMData * align(EMData * this_img, EMData * to_img) const
01228 {
01229 return align(this_img, to_img, "sqeuclidean", Dict());
01230 }
01231
01232 virtual string get_name() const
01233 {
01234 return NAME;
01235 }
01236
01237 virtual string get_desc() const
01238 {
01239 return "Refines a preliminary 2D alignment using a simplex algorithm. Subpixel precision.";
01240 }
01241
01242 static Aligner *NEW()
01243 {
01244 return new RefineAligner();
01245 }
01246
01247 virtual TypeDict get_param_types() const
01248 {
01249 TypeDict d;
01250
01251 d.put("mode", EMObject::INT, "Currently unused");
01252 d.put("xform.align2d", EMObject::TRANSFORM, "The Transform storing the starting guess. If unspecified the identity matrix is used");
01253 d.put("stepx", EMObject::FLOAT, "The x increment used to create the starting simplex. Default is 1");
01254 d.put("stepy", EMObject::FLOAT, "The y increment used to create the starting simplex. Default is 1");
01255 d.put("stepaz", EMObject::FLOAT, "The rotational increment used to create the starting simplex. Default is 5");
01256 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.04.");
01257 d.put("maxiter", EMObject::INT,"The maximum number of iterations that can be performed by the Simplex minimizer. default=28");
01258 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.");
01259 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.");
01260 d.put("mask", EMObject::EMDATA, "A mask to be applied to the image being aligned prior to each similarity comparison.");
01261 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");
01262 return d;
01263 }
01264
01265 static const string NAME;
01266 };
01267
01268
01278 class RefineAlignerCG:public Aligner
01279 {
01280 public:
01281 virtual EMData * align(EMData * this_img, EMData * to_img,
01282 const string & cmp_name="dot", const Dict& cmp_params = Dict()) const;
01283
01284 virtual EMData * align(EMData * this_img, EMData * to_img) const
01285 {
01286 return align(this_img, to_img, "sqeuclidean", Dict());
01287 }
01288
01289 virtual string get_name() const
01290 {
01291 return NAME;
01292 }
01293
01294 virtual string get_desc() const
01295 {
01296 return "Refines a preliminary 2D alignment using a simplex algorithm. Subpixel precision.";
01297 }
01298
01299 static Aligner *NEW()
01300 {
01301 return new RefineAlignerCG();
01302 }
01303
01304 virtual TypeDict get_param_types() const
01305 {
01306 TypeDict d;
01307
01308 d.put("mode", EMObject::INT, "Currently unused");
01309 d.put("xform.align2d", EMObject::TRANSFORM, "The Transform storing the starting guess. If unspecified the identity matrix is used");
01310 d.put("step", EMObject::FLOAT, "The x increment used to create the starting simplex. Default is 0.1");
01311 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.02.");
01312 d.put("maxiter", EMObject::INT,"The maximum number of iterations that can be performed by the Simplex minimizer. default=12");
01313 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.");
01314 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.");
01315 d.put("mask", EMObject::EMDATA, "A mask to be applied to the image being aligned prior to each similarity comparison.");
01316 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");
01317 return d;
01318 }
01319
01320 static const string NAME;
01321 };
01322
01329 class SymAlignProcessorQuat : public Aligner
01330 {
01331 public:
01332 virtual EMData * align(EMData * this_img, EMData * to_img,
01333 const string & cmp_name="ccc", const Dict& cmp_params = Dict()) const;
01334
01335 virtual EMData * align(EMData * this_img, EMData * to_img) const
01336 {
01337 return align(this_img, to_img, "ccc", Dict());
01338 }
01339
01340 virtual string get_name() const
01341 {
01342 return NAME;
01343 }
01344 static Aligner *NEW()
01345 {
01346 return new SymAlignProcessorQuat();
01347 }
01348 string get_desc() const
01349 {
01350 return "Finds the symmetry axis using the simplex algorithm.";
01351 }
01352 virtual TypeDict get_param_types() const
01353 {
01354 TypeDict d;
01355 d.put("sym", EMObject::STRING, "The symmettry. Default is c1");
01356 d.put("xform.align3d", EMObject::TRANSFORM, "The initial guess for to align the particel to sym axis");
01357 d.put("stepx", EMObject::FLOAT, "The initial simplex step size in x. Default is 1");
01358 d.put("stepy", EMObject::FLOAT, "The initial simplex step size in y. Default is 1");
01359 d.put("stepz", EMObject::FLOAT, "The initial simplex step size in z. Default is 1." );
01360 d.put("stepn0", EMObject::FLOAT, "The initial simplex step size in the first quaternion vecotr component. Default is 1." );
01361 d.put("stepn1", EMObject::FLOAT, "The initial simplex step size in the second quaternion vecotr component. Default is 1." );
01362 d.put("stepn2", EMObject::FLOAT, "The initial simplex step size in the third quaternion vecotr component. Default is 1." );
01363 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.");
01364 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.01." );
01365 d.put("maxiter", EMObject::INT, "The maximum number of iterations that can be performed by the Simplex minimizer. Default is 100.");
01366 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.");
01367 return d;
01368 }
01369 static const string NAME;
01370 };
01371
01390 class Refine3DAlignerGrid:public Aligner
01391 {
01392 public:
01393 virtual EMData * align(EMData * this_img, EMData * to_img,
01394 const string & cmp_name="sqeuclidean", const Dict& cmp_params = Dict()) const;
01395
01396 virtual EMData * align(EMData * this_img, EMData * to_img) const
01397 {
01398 return align(this_img, to_img, "sqeuclidean", Dict());
01399 }
01400
01401 virtual string get_name() const
01402 {
01403 return NAME;
01404 }
01405
01406 virtual string get_desc() const
01407 {
01408 return "Refines a preliminary 3D alignment using a simplex algorithm. Subpixel precision.";
01409 }
01410
01411 static Aligner *NEW()
01412 {
01413 return new Refine3DAlignerGrid();
01414 }
01415
01416 virtual TypeDict get_param_types() const
01417 {
01418 TypeDict d;
01419 d.put("xform.align3d", EMObject::TRANSFORM,"The Transform storing the starting guess. If unspecified the identity matrix is used");
01420 d.put("delta", EMObject::FLOAT, "The angular step size. Default is 1." );
01421 d.put("range", EMObject::FLOAT, "The angular range size. Default is 10." );
01422 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01423 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.");
01424 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.");
01425 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.");
01426 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");
01427 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01428 return d;
01429 }
01430
01431 static const string NAME;
01432 };
01433
01455 class Refine3DAlignerQuaternion:public Aligner
01456 {
01457 public:
01458 virtual EMData * align(EMData * this_img, EMData * to_img,
01459 const string & cmp_name="sqeuclidean", const Dict& cmp_params = Dict()) const;
01460
01461 virtual EMData * align(EMData * this_img, EMData * to_img) const
01462 {
01463 return align(this_img, to_img, "sqeuclidean", Dict());
01464 }
01465
01466 virtual string get_name() const
01467 {
01468 return NAME;
01469 }
01470
01471 virtual string get_desc() const
01472 {
01473 return "Refines a preliminary 3D alignment using a simplex algorithm. Subpixel precision.";
01474 }
01475
01476 static Aligner *NEW()
01477 {
01478 return new Refine3DAlignerQuaternion();
01479 }
01480
01481 virtual TypeDict get_param_types() const
01482 {
01483 TypeDict d;
01484 d.put("xform.align3d", EMObject::TRANSFORM,"The Transform storing the starting guess. If unspecified the identity matrix is used");
01485 d.put("stepx", EMObject::FLOAT, "The initial simplex step size in x. Default is 1");
01486 d.put("stepy", EMObject::FLOAT, "The initial simplex step size in y. Default is 1");
01487 d.put("stepz", EMObject::FLOAT, "The initial simplex step size in z. Default is 1." );
01488 d.put("stepn0", EMObject::FLOAT, "The initial simplex step size in the first quaternion vecotr component. Default is 1." );
01489 d.put("stepn1", EMObject::FLOAT, "The initial simplex step size in the second quaternion vecotr component. Default is 1." );
01490 d.put("stepn2", EMObject::FLOAT, "The initial simplex step size in the third quaternion vecotr component. Default is 1." );
01491 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.");
01492 d.put("precision", EMObject::FLOAT, "The precision which, if achieved, can stop the iterative refinement before reaching the maximum iterations. Default is 0.01." );
01493 d.put("maxiter", EMObject::INT, "The maximum number of iterations that can be performed by the Simplex minimizer. Default is 100.");
01494 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.");
01495 return d;
01496 }
01497
01498 static const string NAME;
01499 };
01500
01524 class RT3DGridAligner:public Aligner
01525 {
01526 public:
01529 virtual EMData * align(EMData * this_img, EMData * to_img,
01530 const string & cmp_name="ccc.tomo", const Dict& cmp_params = Dict()) const;
01533 virtual EMData * align(EMData * this_img, EMData * to_img) const
01534 {
01535 return align(this_img, to_img, "ccc.tomo", Dict());
01536 }
01537
01538
01541 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;
01542
01543 virtual string get_name() const
01544 {
01545 return NAME;
01546 }
01547
01548 virtual string get_desc() const
01549 {
01550 return "3D rotational and translational alignment using specified ranges and maximum shifts";
01551 }
01552
01553 static Aligner *NEW()
01554 {
01555 return new RT3DGridAligner();
01556 }
01557
01558 virtual TypeDict get_param_types() const
01559 {
01560 TypeDict d;
01561 d.put("daz", EMObject::FLOAT,"The angle increment in the azimuth direction. Default is 10");
01562 d.put("az0", EMObject::FLOAT,"Lower bound for the azimuth direction. Default it 0");
01563 d.put("az1", EMObject::FLOAT,"Upper bound for the azimuth direction. Default it 180.0");
01564 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01565 d.put("phi0", EMObject::FLOAT,"Lower bound for the phi direction. Default it 0");
01566 d.put("phi1", EMObject::FLOAT,"Upper bound for the phi direction. Default it 360.0");
01567 d.put("dalt", EMObject::FLOAT,"The angle increment in the altitude direction. Default is 10");
01568 d.put("alt0", EMObject::FLOAT,"Lower bound for the altitude direction. Default it 0");
01569 d.put("alt1", EMObject::FLOAT,"Upper bound for the altitude direction. Default it 360.0");
01570 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01571 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.");
01572 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.");
01573 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.");
01574 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");
01575 d.put("initxform", EMObject::TRANSFORM,"The Transform storing the starting position. If unspecified the identity matrix is used");
01576 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01577 return d;
01578 }
01579
01580 static const string NAME;
01581 };
01582
01608 class RT3DSphereAligner:public Aligner
01609 {
01610 public:
01613 virtual EMData * align(EMData * this_img, EMData * to_img,
01614 const string & cmp_name= "sqeuclidean", const Dict& cmp_params = Dict()) const;
01617 virtual EMData * align(EMData * this_img, EMData * to_img) const
01618 {
01619 return align(this_img, to_img, "sqeuclidean", Dict());
01620 }
01621
01622
01625 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;
01626
01627 virtual string get_name() const
01628 {
01629 return NAME;
01630 }
01631
01632 virtual string get_desc() const
01633 {
01634 return "3D rotational and translational alignment using spherical sampling. Can reduce the search space if symmetry is supplied";
01635 }
01636
01637 static Aligner *NEW()
01638 {
01639 return new RT3DSphereAligner();
01640 }
01641
01642 virtual TypeDict get_param_types() const
01643 {
01644 TypeDict d;
01645 d.put("sym", EMObject::STRING,"The symmtery to use as the basis of the spherical sampling. Default is c1 (asymmetry).");
01646 d.put("orientgen", EMObject::STRING,"Advanced. The orientation generation strategy. Default is eman");
01647 d.put("delta", EMObject::FLOAT,"Angle the separates points on the sphere. This is exclusive of the \'n\' paramater. Default is 10");
01648 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");
01649 d.put("dphi", EMObject::FLOAT,"The angle increment in the phi direction. Default is 10");
01650 d.put("phi0", EMObject::FLOAT,"Lower bound for phi. Default it 0");
01651 d.put("phi1", EMObject::FLOAT,"Upper bound for phi. Default it 360");
01652 d.put("dotrans", EMObject::BOOL,"Do a translational search. Default is True(1)");
01653 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.");
01654 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.");
01655 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.");
01656 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");
01657 d.put("initxform", EMObject::TRANSFORM,"The Transform storing the starting position. If unspecified the identity matrix is used");
01658 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01659 return d;
01660 }
01661
01662 static const string NAME;
01663 };
01664
01676 class RT3DSymmetryAligner:public Aligner
01677 {
01678 public:
01681 virtual EMData * align(EMData * this_img, EMData * to_img,
01682 const string & cmp_name="ccc.tomo", const Dict& cmp_params = Dict()) const;
01685 virtual EMData * align(EMData * this_img, EMData * to_img) const
01686 {
01687 return align(this_img, to_img, "ccc.tomo", Dict());
01688 }
01689
01690
01693 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;
01694
01695 virtual string get_name() const
01696 {
01697 return NAME;
01698 }
01699
01700 virtual string get_desc() const
01701 {
01702 return "3D symmetry aligner";
01703 }
01704
01705 static Aligner *NEW()
01706 {
01707 return new RT3DSymmetryAligner();
01708 }
01709
01710 virtual TypeDict get_param_types() const
01711 {
01712 TypeDict d;
01713 d.put("sym", EMObject::FLOAT,"The symmetry. Default is icos");
01714 d.put("transform", EMObject::TRANSFORM,"The transform to move to symmetry axis");
01715 d.put("verbose", EMObject::BOOL,"Turn this on to have useful information printed to standard out.");
01716 return d;
01717 }
01718
01719 static const string NAME;
01720 };
01721
01722 class FRM2DAligner:public Aligner
01723 {
01724 public:
01725 virtual EMData * align(EMData * this_img, EMData * to_img,
01726 const string& cmp_name, const Dict& cmp_params=Dict()) const;
01727
01728 virtual EMData * align(EMData * this_img, EMData * to_img) const
01729 {
01730 return align(this_img, to_img, "frc", Dict());
01731 }
01732
01733 string get_name() const
01734 {
01735 return NAME;
01736 }
01737
01738 string get_desc() const
01739 {
01740 return "FRM2D uses two rotational parameters and one translational parameter";
01741 }
01742
01743 static Aligner *NEW()
01744 {
01745 return new FRM2DAligner();
01746 }
01747 virtual TypeDict get_param_types() const
01748 {
01749 TypeDict d;
01750 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.");
01751
01752
01753 return d;
01754 }
01755
01756 static const string NAME;
01757 };
01758
01759
01760 class CUDA_Aligner
01761 {
01762 public:
01763 CUDA_Aligner(int id);
01764
01765 void finish();
01766
01767 void setup(int nima, int nx, int ny, int ring_length, int nring, int ou, float step, int kx, int ky, bool ctf);
01768
01769 void insert_image(EMData *image, int num);
01770
01771 void filter_stack(vector<float> ctf_params);
01772
01773 void sum_oe(vector<float> ctf_params, vector<float> ali_params, EMData* ave1, EMData *ave2);
01774
01775 vector<float> alignment_2d(EMData *ref_image, vector<float> sx, vector<float> sy, int silent);
01776
01777 vector<float> ali2d_single_iter(EMData *ref_image, vector<float> ali_params, float csx, float csy, int silent, float delta);
01778
01779 private:
01780 float *image_stack, *image_stack_filtered;
01781 float *ccf;
01782 int NIMA, NX, NY, RING_LENGTH, NRING, OU, KX, KY;
01783 bool CTF;
01784 float STEP;
01785 };
01786
01787 class CUDA_multiref_aligner
01788 {
01789 public:
01790 CUDA_multiref_aligner(int id);
01791
01792 void finish();
01793
01794 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);
01795
01796 void setup_params(vector<float> all_ali_params, vector<float> all_ctf_params);
01797
01798 void insert_image(EMData *image, int num);
01799
01800 void insert_ref_image(EMData *image, int num);
01801
01802 vector<float> multiref_ali2d(int silent);
01803
01804 private:
01805 float *image_stack, *ref_image_stack, *ref_image_stack_filtered;
01806 float *ccf;
01807 float *ali_params, *ctf_params;
01808 int NIMA, NREF, NX, NY, RING_LENGTH, NRING, OU, KX, KY, MAX_IMAGE_BATCH;
01809 bool CTF;
01810 float STEP;
01811 };
01812
01813 template <> Factory < Aligner >::Factory();
01814
01815 void dump_aligners();
01816 map<string, vector<string> > dump_aligners_list();
01817 }
01818
01819 #endif