Go to the documentation of this file.00001
00002 #ifndef vimt3d_trilin_interp_h_
00003 #define vimt3d_trilin_interp_h_
00004
00005
00006
00007
00008
00009 #include <vimt3d/vimt3d_image_3d_of.h>
00010 #include <vgl/vgl_point_3d.h>
00011 #include <vil3d/vil3d_trilin_interp.h>
00012 #include <vil3d/vil3d_image_view.h>
00013
00014
00015
00016
00017 template<class T>
00018 inline double vimt3d_trilin_interp_safe(const vimt3d_image_3d_of<T>& image,
00019 const vgl_point_3d<double>& p,
00020 unsigned plane=0,
00021 T outval=0)
00022 {
00023 vgl_point_3d<double> im_p = image.world2im()(p);
00024 const vil3d_image_view<T>& im = image.image();
00025 return vil3d_trilin_interp_safe(im_p.x(),im_p.y(),im_p.z(),
00026 im.origin_ptr()+plane*im.planestep(),
00027 im.ni(),im.nj(),im.nk(),
00028 im.istep(),im.jstep(),im.kstep(),
00029 outval);
00030 }
00031
00032
00033
00034 template<class T>
00035 inline double vimt3d_trilin_interp_raw(const vimt3d_image_3d_of<T>& image,
00036 const vgl_point_3d<double>& p,
00037 unsigned plane=0)
00038 {
00039 vgl_point_3d<double> im_p = image.world2im()(p);
00040 const vil3d_image_view<T>& im = image.image();
00041 return vil3d_trilin_interp_raw(im_p.x(),im_p.y(),im_p.z(),
00042 im.origin_ptr()+plane*im.planestep(),
00043 im.istep(),im.jstep(),im.kstep());
00044 }
00045
00046
00047
00048
00049 template<class T>
00050 inline double vimt3d_trilin_interp_safe_extend(const vimt3d_image_3d_of<T>& image,
00051 const vgl_point_3d<double>& p,
00052 unsigned plane=0)
00053 {
00054 vgl_point_3d<double> im_p = image.world2im()(p);
00055 const vil3d_image_view<T>& im = image.image();
00056 return vil3d_trilin_interp_safe_extend(im_p.x(),im_p.y(),im_p.z(),
00057 im.origin_ptr()+plane*im.planestep(),
00058 im.ni(),im.nj(),im.nk(),
00059 im.istep(),im.jstep(),im.kstep());
00060 }
00061
00062 #endif // vimt3d_trilin_interp_h_