Go to the documentation of this file.00001 #ifndef vil3d_structuring_element_h_
00002 #define vil3d_structuring_element_h_
00003
00004
00005
00006
00007
00008 #include <vcl_vector.h>
00009 #include <vcl_iosfwd.h>
00010 #include <vcl_cstddef.h>
00011
00012
00013
00014
00015 class vil3d_structuring_element
00016 {
00017
00018 vcl_vector<int> p_i_;
00019
00020 vcl_vector<int> p_j_;
00021
00022 vcl_vector<int> p_k_;
00023
00024 int min_i_;
00025
00026 int max_i_;
00027
00028 int min_j_;
00029
00030 int max_j_;
00031
00032 int min_k_;
00033
00034 int max_k_;
00035
00036 public:
00037 vil3d_structuring_element()
00038 : min_i_(0),max_i_(-1),min_j_(0),max_j_(-1),min_k_(0),max_k_(-1) {}
00039
00040
00041 vil3d_structuring_element(const vcl_vector<int>& p_i,
00042 const vcl_vector<int>& p_j,
00043 const vcl_vector<int>& p_k);
00044
00045
00046 void set(const vcl_vector<int>& p_i,
00047 const vcl_vector<int>& p_j,
00048 const vcl_vector<int>& p_k);
00049
00050
00051
00052 void set_to_sphere(double r);
00053
00054
00055
00056 void set_to_circle_i(double r);
00057
00058
00059
00060 void set_to_circle_j(double r);
00061
00062
00063
00064 void set_to_circle_k(double r);
00065
00066
00067 void set_to_7();
00068
00069
00070 void set_to_27();
00071
00072
00073
00074
00075 void set_to_sphere_noniso(double r, double sx, double sy, double sz);
00076
00077
00078 void set_to_line_i(int ilo, int ihi);
00079
00080
00081 void set_to_line_j(int jlo, int jhi);
00082
00083
00084 void set_to_line_k(int klo, int khi);
00085
00086
00087 const vcl_vector<int>& p_i() const { return p_i_; }
00088
00089 const vcl_vector<int>& p_j() const { return p_j_; }
00090
00091 const vcl_vector<int>& p_k() const { return p_k_; }
00092
00093
00094 int min_i() const { return min_i_; }
00095
00096 int max_i() const { return max_i_; }
00097
00098 int min_j() const { return min_j_; }
00099
00100 int max_j() const { return max_j_; }
00101
00102 int min_k() const { return min_k_; }
00103
00104 int max_k() const { return max_k_; }
00105 };
00106
00107
00108 vcl_ostream& operator<<(vcl_ostream&, const vil3d_structuring_element& element);
00109
00110
00111
00112
00113
00114
00115 void vil3d_compute_offsets(vcl_vector<vcl_ptrdiff_t>& offset,
00116 const vil3d_structuring_element& element,
00117 vcl_ptrdiff_t istep,
00118 vcl_ptrdiff_t jstep,
00119 vcl_ptrdiff_t kstep);
00120
00121 #endif // vil3d_structuring_element_h_