contrib/mul/msdi/msdi_reflected_marked_images.h
Go to the documentation of this file.
00001 #ifndef msdi_reflected_marked_images_h_
00002 #define msdi_reflected_marked_images_h_
00003 
00004 //:
00005 // \file
00006 // \author Tim Cootes
00007 // \brief Adaptor which generates reflected versions of images/points
00008 
00009 #include <msdi/msdi_marked_images.h>
00010 #include <msm/msm_points.h>
00011 #include <vimt/vimt_image_pyramid.h>
00012 #include <vimt/vimt_gaussian_pyramid_builder_2d.h>
00013 
00014 //: Adaptor which generates reflected versions of images/points
00015 //  Given a source haam_marked_images, generates a reflected version
00016 //  of each image/points pair.  
00017 //  If only_reflect, then returns reflected version only.
00018 //  If not only_reflect, then return both reflected and original
00019 //  examples.
00020 class msdi_reflected_marked_images : public msdi_marked_images {
00021 private:
00022   //: Original data
00023   msdi_marked_images& marked_images_;
00024 
00025   //: Indicate correspondences between shape and its reflection
00026   vcl_vector<unsigned> sym_pts_;
00027 
00028   //: When true, supply only reflection of original data
00029   //  When false, supply original and reflection.
00030   bool only_reflect_;
00031 
00032   //: Current image pyramid
00033   vimt_image_pyramid image_pyr_;
00034 
00035   //: Current base image
00036   vimt_image_2d_of<vxl_byte> image_;
00037 
00038   //: Current points
00039   msm_points points_;
00040 
00041   //: True on first pass
00042   bool first_pass_;
00043 
00044   //: True if points are current
00045   bool points_ok_;
00046 
00047   //: True if image_ is current
00048   bool image_ok_;
00049 
00050   //: True if image_pyr_ is current
00051   bool image_pyr_ok_;
00052 
00053   //: Generate current image
00054   void get_image();
00055 
00056   //: Generate current points
00057   void get_points();
00058 
00059   //: Pyramid builder
00060   vimt_gaussian_pyramid_builder_2d<vxl_byte> pyr_builder_;
00061 
00062   // Private copy operator to prevent copying
00063   msdi_reflected_marked_images& operator=(const msdi_reflected_marked_images&);
00064 public:
00065     //: Default constructor
00066     // /params sym_pts[i] indicates symmetric match to point i
00067     // /params only_reflect: When true, only supply reflected shapes.
00068   msdi_reflected_marked_images(msdi_marked_images& raw_data,
00069                              const vcl_vector<unsigned>& sym_pts,
00070                              bool only_reflect=false);
00071 
00072     //: Construct with external vectors of images and points
00073     //  Pointers retained to both - they must stay in scope.
00074   msdi_reflected_marked_images();
00075 
00076     //: Destructor
00077   virtual ~msdi_reflected_marked_images();
00078 
00079   //: Pyramid builder to be used
00080   vimt_gaussian_pyramid_builder_2d<vxl_byte>& pyr_builder()
00081   { return pyr_builder_; }
00082 
00083   //: Move to start of data
00084   virtual void reset();
00085 
00086   //: Move to next item.  Return true until reach end of items
00087   virtual bool next();
00088 
00089   //: Return number of examples this will provide
00090   virtual unsigned size() const;
00091 
00092   //: Return current image
00093   virtual const vimt_image_2d& image();
00094 
00095   //: Return current image pyramid
00096   virtual const vimt_image_pyramid& image_pyr();
00097 
00098   //: points for the current image
00099   virtual const msm_points& points();
00100 
00101     //: Return current image file name
00102   virtual vcl_string image_name() const;
00103 
00104     //: Return current points file name
00105   virtual vcl_string points_name() const;
00106 };
00107 
00108 #endif // msdi_reflected_marked_images_h_
00109 
00110 
00111