1 // This is mul/vil3d/algo/vil3d_gauss_reduce.h 2 #ifndef vil3d_gauss_reduce_h_ 3 #define vil3d_gauss_reduce_h_ 4 //: 5 // \file 6 // \brief Functions to smooth and sub-sample 3D images in one direction 7 // 8 // These are not templated because 9 // - Each type tends to need a slightly different implementation 10 // - Let's not have too many templates. 11 // \author Tim Cootes 12 13 #include <vil3d/vil3d_image_view.h> 14 15 16 //: Smooth and subsample single plane src_im in i to produce dest_im 17 // Applies 1-5-8-5-1 filter in i, then samples 18 // every other pixel. Fills [0,(ni+1)/2-1][0,nj-1][0,nk-1] elements of dest 19 // Assumes dest_im has sufficient data allocated. 20 // 21 // By applying three times we can obtain a full gaussian smoothed and 22 // sub-sampled 3D image 23 template<class T> 24 void vil3d_gauss_reduce_i(const T* src_im, 25 unsigned src_ni, unsigned src_nj, unsigned src_nk, 26 std::ptrdiff_t s_i_step, std::ptrdiff_t s_j_step, 27 std::ptrdiff_t s_k_step, 28 T* dest_im, 29 std::ptrdiff_t d_i_step, 30 std::ptrdiff_t d_j_step, std::ptrdiff_t d_k_step); 31 32 //: Smooth and subsample src_im to produce dest_im 33 // Applies filter in i,j and k directions, then samples every other pixel. 34 // Resulting image is (ni+1)/2 x (nj+1)/2 x (nk+1)/2. 35 // An image can be reduced in-place, by having src_im and dest_im 36 // pointing to the same image. 37 template<class T> 38 void vil3d_gauss_reduce(const vil3d_image_view<T>& src_im, 39 vil3d_image_view<T>& dest_im, 40 vil3d_image_view<T>& work_im1, 41 vil3d_image_view<T>& work_im2); 42 43 //: Smooth and subsample src_im along i and j to produce dest_im 44 // Applies filter in i,j directions, then samples every other pixel. 45 // Resulting image is (ni+1)/2 x (nj+1)/2 x nk 46 template<class T> 47 void vil3d_gauss_reduce_ij(const vil3d_image_view<T>& src_im, 48 vil3d_image_view<T>& dest_im, 49 vil3d_image_view<T>& work_im1); 50 51 //: Smooth and subsample src_im along i and k to produce dest_im 52 // Applies filter in i,k directions, then samples every other pixel. 53 // Resulting image is (ni+1)/2 x nj x (nk+1)/2 54 template<class T> 55 void vil3d_gauss_reduce_ik(const vil3d_image_view<T>& src_im, 56 vil3d_image_view<T>& dest_im, 57 vil3d_image_view<T>& work_im1); 58 59 //: Smooth and subsample src_im along j and k to produce dest_im 60 // Applies filter in j,k directions, then samples every other pixel. 61 // Resulting image is ni x (nj+1)/2 x (nk+1)/2 62 template<class T> 63 void vil3d_gauss_reduce_jk(const vil3d_image_view<T>& src_im, 64 vil3d_image_view<T>& dest_im, 65 vil3d_image_view<T>& work_im1); 66 67 #define VIL3D_GAUSS_REDUCE_INSTANTIATE(T) extern "please include vil3d/vil3d_gauss_reduce.txx instead" 68 69 #endif // vil3d_gauss_reduce_h_ 70