contrib/mul/vimt3d/vimt3d_sample_grid_trilin.h
Go to the documentation of this file.
00001 // This is mul/vimt3d/vimt3d_sample_grid_trilin.h
00002 #ifndef vimt3d_sample_grid_trilin_h_
00003 #define vimt3d_sample_grid_trilin_h_
00004 //:
00005 // \file
00006 // \brief Grid sampling functions for 3D images
00007 // \author Graham Vincent, Tim Cootes
00008 
00009 #include <vimt3d/vimt3d_image_3d_of.h>
00010 #include <vnl/vnl_fwd.h>
00011 #include <vgl/vgl_fwd.h>
00012 
00013 //: Sample grid p+i.u+j.v+k.w using trilinear interpolation in world coordinates
00014 //  Profile points are p+i.u+j.v+k.w, where i=[0..nu-1],j=[0..nv-1], k=[0..nw-1]
00015 //  Vector v is resized to nu*nv*nw*np elements, where np=image.n_planes().
00016 //  v[0]..v[np-1] are the values from point p
00017 //  Samples are taken along each image plane first, then direction w, then v, and u.
00018 template <class imType, class vecType>
00019 void vimt3d_sample_grid_trilin(vnl_vector<vecType>& vec,
00020                                const vimt3d_image_3d_of<imType>& image,
00021                                const vgl_point_3d<double>& p,
00022                                const vgl_vector_3d<double>& u,
00023                                const vgl_vector_3d<double>& v,
00024                                const vgl_vector_3d<double>& w,
00025                                unsigned nu, unsigned nv, unsigned nw);
00026 
00027 
00028 //: Sample grid p+i.u+j.v+k.w using trilinear interpolation in world coordinates.
00029 //  Profile points are p+i.u+j.v+k.w, where i=[0..nu-1],j=[0..nv-1], k=[0..nw-1]
00030 //  Vector v is resized to nu*nv*nw*np elements, where np=image.n_planes().
00031 //  v[0]..v[np-1] are the values from point p.
00032 //  Samples are taken along each image plane first, then direction w, then v, and u.
00033 //  Samples outside the image are set to the value of the nearest voxel's value.
00034 template <class imType, class vecType>
00035 void vimt3d_sample_grid_trilin_extend(
00036   vnl_vector<vecType>& vec,
00037   const vimt3d_image_3d_of<imType>& image,
00038   const vgl_point_3d<double>& p,
00039   const vgl_vector_3d<double>& u,
00040   const vgl_vector_3d<double>& v,
00041   const vgl_vector_3d<double>& w,
00042   unsigned nu, unsigned nv, unsigned nw);
00043 
00044 
00045 //: Sample grid p+i.u+j.v+k.w using trilinear interpolation in world coordinates.
00046 //  Profile points are p+i.u+j.v+k.w, where i=[0..nu-1],j=[0..nv-1], k=[0..nw-1]
00047 //  Vector v is resized to nu*nv*nw*np elements, where np=image.n_planes().
00048 //  v[0]..v[np-1] are the values from point p.
00049 //  Samples are taken along each image plane first, then direction w, then v, and u.
00050 //  Samples outside the image are set to NA.
00051 template <class imType, class vecType>
00052 void vimt3d_sample_grid_trilin_edgena(
00053   vnl_vector<vecType>& vec,
00054   const vimt3d_image_3d_of<imType>& image,
00055   const vgl_point_3d<double>& p,
00056   const vgl_vector_3d<double>& u,
00057   const vgl_vector_3d<double>& v,
00058   const vgl_vector_3d<double>& w,
00059   unsigned nu, unsigned nv, unsigned nw);
00060 
00061 
00062 //: Sample grid p+i.u+j.v+k.w using trilinear interpolation in image coordinates
00063 //  Profile points are im_p+i.im_u+j.im_v+k.im_w, where i=[0..nu-1],j=[0..nv-1], k=[0..nw-1]
00064 //  Vector v is resized to nu*nv*nw*np elements, where np=image.n_planes().
00065 //  v[0]..v[np-1] are the values from point p
00066 //  Samples are taken along each image plane first, then direction w, then v, and u.
00067 template <class imType, class vecType>
00068 void vimt3d_sample_grid_trilin_ic(vnl_vector<vecType>& vec,
00069                                   const vil3d_image_view<imType>& image,
00070                                   const vgl_point_3d<double>& im_p,
00071                                   const vgl_vector_3d<double>& im_u,
00072                                   const vgl_vector_3d<double>& im_v,
00073                                   const vgl_vector_3d<double>& im_w,
00074                                   unsigned nu, unsigned nv, unsigned nw);
00075 
00076 #endif // vimt3d_sample_grid_trilin_h_