contrib/rpl/rgrl/rgrl_initializer.h
Go to the documentation of this file.
00001 #ifndef rgrl_initializer_h_
00002 #define rgrl_initializer_h_
00003 //:
00004 // \file
00005 // \brief Base class for generating initial estimates.
00006 // \author Chuck Stewart
00007 // \date 12 Nov 2002
00008 //
00009 // \verbatim
00010 //  Modifications:
00011 //   Jan 2004 Charlene: Added other non-virtual functions to hide view.
00012 // \endverbatim
00013 
00014 #include <rgrl/rgrl_transformation_sptr.h>
00015 #include <rgrl/rgrl_estimator_sptr.h>
00016 #include <rgrl/rgrl_view_sptr.h>
00017 #include <rgrl/rgrl_scale_sptr.h>
00018 #include <rgrl/rgrl_initializer_sptr.h>
00019 #include <rgrl/rgrl_mask.h>
00020 #include <rgrl/rgrl_mask_sptr.h>
00021 
00022 //: Interface for initial estimate generators.
00023 class rgrl_initializer
00024   : public rgrl_object
00025 {
00026  public:
00027   rgrl_initializer() : use_prior_scale_from_match_(true)
00028   {   }
00029 
00030   virtual ~rgrl_initializer();
00031 
00032   //: Get next initial view.
00033   //
00034   // Return true iff an estimate is available.  The initial
00035   // transformation estimate must have a covariance matrix filled in
00036   // because it is used in matching
00037   //
00038   // This is the only pure virtual function implemented in the derived classes.
00039   virtual bool next_initial( rgrl_view_sptr           & view,
00040                              rgrl_scale_sptr          & prior_scale) = 0;
00041 
00042   //: Get next set of initial information without the notion of a view.
00043   //
00044   bool next_initial( rgrl_mask_sptr           & from_image_roi,
00045                      rgrl_mask_sptr           & to_image_roi,
00046                      rgrl_mask_box            & current_region,
00047                      rgrl_mask_box            & global_region,
00048                      rgrl_estimator_sptr      & xform_estimator,
00049                      rgrl_transformation_sptr & xform_estimate,
00050                      unsigned                 & current_resolution,
00051                      rgrl_scale_sptr          & prior_scale);
00052 
00053   //: Get next set of initial information, assuming \a current_region is the region of interest for registration.
00054   //
00055   bool next_initial( rgrl_mask_box            & current_region,
00056                      rgrl_estimator_sptr      & xform_estimator,
00057                      rgrl_transformation_sptr & xform_estimate,
00058                      unsigned                 & current_resolution,
00059                      rgrl_scale_sptr          & prior_scale);
00060 
00061   //: Get next set of initial information, assuming \a current_region is the region of interest for registration, and single-resol.
00062   //
00063   bool next_initial( rgrl_mask_box            & current_region,
00064                      rgrl_estimator_sptr      & xform_estimator,
00065                      rgrl_transformation_sptr & xform_estimate,
00066                      rgrl_scale_sptr          & prior_scale);
00067 
00068   //: force the setting of prior scale
00069   //  scale > 0    set to this scale value
00070   //  scale == 0   scale pointer is NULL, which indicates to use unwgted scale estimate
00071   //  scale < 0    use whatever scale set by the match
00072   void set_prior_geometric_scale( double scale );
00073 
00074   //: return number of initializations
00075   //  -1 stands for unknown
00076   virtual int size() const = 0;
00077 
00078   // Defines type-related functions
00079   rgrl_type_macro( rgrl_initializer, rgrl_object );
00080 
00081  protected:
00082   //: Generate a prior scale depending on current settings
00083   rgrl_scale_sptr enforce_prior_scale( rgrl_scale_sptr match_scale );
00084 
00085  protected:
00086   rgrl_scale_sptr prior_scale_;
00087   bool            use_prior_scale_from_match_;
00088 };
00089 
00090 #endif // rgrl_initializer_h_