Go to the documentation of this file.00001 #ifndef vil3d_exp_distance_transform_h_
00002 #define vil3d_exp_distance_transform_h_
00003
00004
00005
00006
00007
00008 #include <vil3d/vil3d_image_view.h>
00009 #include <vil3d/vil3d_plane.h>
00010 #include <vil3d/algo/vil3d_make_edt_filter.h>
00011 #include <vil3d/algo/vil3d_max_product_filter.h>
00012
00013
00014
00015
00016
00017
00018
00019 template<class T>
00020 void vil3d_exp_distance_transform(vil3d_image_view<T>& image,
00021 double width_i,
00022 double width_j,
00023 double width_k,
00024 int r)
00025 {
00026
00027 vil3d_structuring_element se;
00028 vcl_vector<double> f;
00029 vil3d_make_edt_filter(width_i,width_j,width_k,r,se,f);
00030
00031 for (unsigned p=0;p<image.nplanes();++p)
00032 {
00033 vil3d_image_view<T> image_p = vil3d_plane(image,p);
00034
00035
00036 vil3d_max_product_filter(image_p,se,f);
00037 unsigned ni = image.ni();
00038 unsigned nj = image.nj();
00039 unsigned nk = image.nk();
00040
00041 vcl_ptrdiff_t istep = image.istep();
00042 vcl_ptrdiff_t jstep = image.jstep();
00043 vcl_ptrdiff_t kstep = image.kstep();
00044
00045 vil3d_image_view<T> flipped_image(&image(ni-1,nj-1,nk-1,p),
00046 ni,nj,nk,1,
00047 -istep,-jstep,-kstep,
00048 image.planestep());
00049
00050 vil3d_max_product_filter(flipped_image,se,f);
00051 }
00052 }
00053
00054
00055 #endif // vil3d_exp_distance_transform_h_