contrib/mul/vil3d/algo/vil3d_gauss_reduce.h
Go to the documentation of this file.
00001 // This is mul/vil3d/algo/vil3d_gauss_reduce.h
00002 #ifndef vil3d_gauss_reduce_h_
00003 #define vil3d_gauss_reduce_h_
00004 //:
00005 // \file
00006 // \brief Functions to smooth and sub-sample 3D images in one direction
00007 //
00008 //  These are not templated because
00009 //  - Each type tends to need a slightly different implementation
00010 //  - Let's not have too many templates.
00011 // \author Tim Cootes
00012 
00013 #include <vil3d/vil3d_image_view.h>
00014 
00015 
00016 //: Smooth and subsample single plane src_im in i to produce dest_im
00017 //  Applies 1-5-8-5-1 filter in i, then samples
00018 //  every other pixel.  Fills [0,(ni+1)/2-1][0,nj-1][0,nk-1] elements of dest
00019 //  Assumes dest_im has sufficient data allocated.
00020 //
00021 //  By applying three times we can obtain a full gaussian smoothed and
00022 //  sub-sampled 3D image
00023 template<class T>
00024 void vil3d_gauss_reduce_i(const T* src_im,
00025                           unsigned src_ni, unsigned src_nj, unsigned src_nk,
00026                           vcl_ptrdiff_t s_i_step, vcl_ptrdiff_t s_j_step,
00027                           vcl_ptrdiff_t s_k_step,
00028                           T* dest_im,
00029                           vcl_ptrdiff_t d_i_step,
00030                           vcl_ptrdiff_t d_j_step, vcl_ptrdiff_t d_k_step);
00031 
00032 //: Smooth and subsample src_im to produce dest_im
00033 //  Applies filter in i,j and k directions, then samples every other pixel.
00034 //  Resulting image is (ni+1)/2 x (nj+1)/2 x (nk+1)/2. 
00035 //  An image can be reduced in-place, by having src_im and dest_im 
00036 //  pointing to the same image.
00037 template<class T>
00038 void vil3d_gauss_reduce(const vil3d_image_view<T>& src_im,
00039                         vil3d_image_view<T>&       dest_im,
00040                         vil3d_image_view<T>&       work_im1,
00041                         vil3d_image_view<T>&       work_im2);
00042 
00043 //: Smooth and subsample src_im along i and j to produce dest_im
00044 //  Applies filter in i,j directions, then samples every other pixel.
00045 //  Resulting image is (ni+1)/2 x (nj+1)/2 x nk
00046 template<class T>
00047 void vil3d_gauss_reduce_ij(const vil3d_image_view<T>& src_im,
00048                            vil3d_image_view<T>&       dest_im,
00049                            vil3d_image_view<T>&       work_im1);
00050 
00051 //: Smooth and subsample src_im along i and k to produce dest_im
00052 //  Applies filter in i,k directions, then samples every other pixel.
00053 //  Resulting image is (ni+1)/2 x nj x (nk+1)/2
00054 template<class T>
00055 void vil3d_gauss_reduce_ik(const vil3d_image_view<T>& src_im,
00056                            vil3d_image_view<T>&       dest_im,
00057                            vil3d_image_view<T>&       work_im1);
00058 
00059 //: Smooth and subsample src_im along j and k to produce dest_im
00060 //  Applies filter in j,k directions, then samples every other pixel.
00061 //  Resulting image is ni x (nj+1)/2 x (nk+1)/2
00062 template<class T>
00063 void vil3d_gauss_reduce_jk(const vil3d_image_view<T>& src_im,
00064                            vil3d_image_view<T>&       dest_im,
00065                            vil3d_image_view<T>&       work_im1);
00066 
00067 #define VIL3D_GAUSS_REDUCE_INSTANTIATE(T) extern "please include vil3d/vil3d_gauss_reduce.txx instead"
00068 
00069 #endif // vil3d_gauss_reduce_h_