Go to the documentation of this file.00001 #ifndef vil_region_finder_h_
00002 #define vil_region_finder_h_
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 #include <vcl_vector.h>
00011 #include <vcl_functional.h>
00012 #include <vil/vil_image_view.h>
00013 
00014 
00015 
00016 
00017 
00018 enum vil_region_finder_connectivity
00019 {
00020   vil_region_finder_4_conn,
00021   vil_region_finder_8_conn
00022 };
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 template <class pix_type, class predicate_type = vcl_equal_to<pix_type> >
00033 class vil_region_finder
00034 {
00035  public:
00036   
00037   typedef vil_image_view<pix_type> image_view;
00038 
00039   
00040   vil_region_finder( image_view const& image,
00041                      vil_region_finder_connectivity conn = vil_region_finder_4_conn );
00042 
00043   
00044   
00045   
00046   
00047   
00048   
00049   
00050   
00051   void
00052   same_int_region( unsigned i, unsigned j,
00053                    vcl_vector<unsigned>& ri,
00054                    vcl_vector<unsigned>& rj );
00055 
00056 
00057   
00058   
00059   
00060   
00061   
00062   
00063   
00064   void
00065   same_int_region( unsigned i, unsigned j, pix_type p,
00066                    vcl_vector<unsigned>& ri,
00067                    vcl_vector<unsigned>& rj );
00068 
00069   
00070   image_view const&
00071   image() const;
00072 
00073   
00074   vil_image_view<bool> const&  boolean_region_image() const;
00075 
00076  private:
00077   
00078   
00079   
00080   
00081   void
00082   init( vil_region_finder_connectivity );
00083 
00084   
00085   image_view const image_;
00086 
00087   
00088   vil_image_view<bool> processed_;
00089 
00090   
00091   unsigned num_nbrs_;
00092 
00093   
00094   int const (*nbr_delta_)[2];
00095 
00096   
00097   predicate_type predi_;
00098 };
00099 
00100 
00101 #include "vil_region_finder.txx"
00102 
00103 #endif // vil_region_finder_h_