Go to the documentation of this file.00001 #ifndef vil3d_binary_dilate_h_
00002 #define vil3d_binary_dilate_h_
00003
00004
00005
00006
00007
00008 #include <vil3d/algo/vil3d_structuring_element.h>
00009 #include <vil3d/vil3d_image_view.h>
00010
00011
00012
00013 inline bool vil3d_binary_dilate(const bool* im, const vcl_ptrdiff_t* offset, unsigned n)
00014 {
00015 for (unsigned i=0;i<n;++i) if (im[offset[i]]) return true;
00016 return false;
00017 }
00018
00019
00020
00021 inline bool vil3d_binary_dilate(const vil3d_image_view<bool>& image, unsigned plane,
00022 const vil3d_structuring_element& element,
00023 int i0, int j0, int k0)
00024 {
00025 unsigned n = element.p_i().size();
00026 for (unsigned int a=0;a<n;++a)
00027 {
00028
00029 unsigned int i = i0+element.p_i()[a];
00030 unsigned int j = j0+element.p_j()[a];
00031 unsigned int k = k0+element.p_k()[a];
00032 if (i<image.ni() && j<image.nj() && k<image.nk() && image(i,j,k,plane))
00033 return true;
00034 }
00035 return false;
00036 }
00037
00038
00039
00040
00041 void vil3d_binary_dilate(const vil3d_image_view<bool>& src_image,
00042 vil3d_image_view<bool>& dest_image,
00043 const vil3d_structuring_element& element);
00044
00045
00046 #endif // vil3d_binary_dilate_h_