Go to the documentation of this file.00001
00002 #ifndef brip_roi_h_
00003 #define brip_roi_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <vsol/vsol_box_2d_sptr.h>
00023 #include <vbl/vbl_ref_count.h>
00024 #include <vcl_vector.h>
00025 #include <vcl_iosfwd.h>
00026
00027 class brip_roi : public vbl_ref_count
00028 {
00029 public:
00030
00031 brip_roi(const unsigned n_image_cols = 0, const unsigned n_image_rows = 0);
00032 brip_roi(brip_roi const& r)
00033 : vbl_ref_count(), n_image_cols_(r.n_image_cols_),
00034 n_image_rows_(r.n_image_rows_), regions_(r.regions_) {}
00035
00036
00037 brip_roi(brip_roi const& roi, const float delta);
00038
00039 ~brip_roi() {}
00040
00041 void set_image_bounds(const int n_image_cols,
00042 const int n_image_rows);
00043
00044
00045 void add_region(const int x0, const int y0, const int xs, const int ys);
00046
00047 void add_region(const int xc, const int yc, const int radius);
00048
00049 void add_region(vsol_box_2d_sptr const & box);
00050
00051
00052 vsol_box_2d_sptr clip_to_image_bounds(vsol_box_2d_sptr box);
00053
00054 void clip_to_image_bounds();
00055 bool empty() const;
00056 unsigned int n_regions() const { return regions_.size(); }
00057 int cmin(const unsigned i) const;
00058 int cmax(const unsigned i) const;
00059 int rmin(const unsigned i) const;
00060 int rmax(const unsigned i) const;
00061 unsigned csize(const unsigned i) const;
00062 unsigned rsize(const unsigned i) const;
00063
00064
00065 unsigned ic(int local_col, unsigned i = 0) const;
00066 unsigned ir(int local_row, unsigned i = 0) const;
00067
00068
00069 unsigned lc(unsigned global_col, unsigned i = 0) const;
00070 unsigned lr(unsigned global_row, unsigned i = 0) const;
00071
00072 vsol_box_2d_sptr region(unsigned i) const { return regions_[i]; }
00073 bool remove_region(unsigned i);
00074
00075 protected:
00076 unsigned n_image_cols_;
00077 unsigned n_image_rows_;
00078 vcl_vector<vsol_box_2d_sptr> regions_;
00079 };
00080
00081 vcl_ostream& operator<<(vcl_ostream& s, brip_roi const& r);
00082
00083 #include "brip_roi_sptr.h"
00084
00085 #endif // brip_roi_h_