Go to the documentation of this file.00001 #ifndef vimt3d_sample_profile_trilin_h_
00002 #define vimt3d_sample_profile_trilin_h_
00003
00004
00005
00006
00007
00008 #include <vimt3d/vimt3d_image_3d_of.h>
00009 #include <vil3d/vil3d_sample_profile_trilin.h>
00010 #include <vnl/vnl_vector.h>
00011 #include <vgl/vgl_point_3d.h>
00012 #include <vgl/vgl_vector_3d.h>
00013
00014
00015
00016
00017
00018
00019 template <class imType, class vecType>
00020 void vimt3d_sample_profile_trilin(
00021 vnl_vector<vecType>& vec,
00022 const vimt3d_image_3d_of<imType>& image,
00023 const vgl_point_3d<double>& p0,
00024 const vgl_vector_3d<double>& u,
00025 int n)
00026 {
00027 vgl_point_3d<double> im_p0 = image.world2im()(p0);
00028 vgl_point_3d<double> im_p1 = image.world2im()(p0+u);
00029 int np = image.image().nplanes();
00030 vec.set_size(n*np);
00031 vecType *v = vec.data_block();
00032
00033
00034 double dx = (im_p1.x()-im_p0.x());
00035 double dy = (im_p1.y()-im_p0.y());
00036 double dz = (im_p1.z()-im_p0.z());
00037
00038
00039 vil3d_sample_profile_trilin(v,image.image(),
00040 im_p0.x(),im_p0.y(),im_p0.z(),dx,dy,dz,n);
00041 }
00042
00043
00044
00045
00046
00047
00048
00049 template <class imType, class vecType>
00050 void vimt3d_sample_profile_trilin_extend(
00051 vnl_vector<vecType>& vec,
00052 const vimt3d_image_3d_of<imType>& image,
00053 const vgl_point_3d<double>& p0,
00054 const vgl_vector_3d<double>& u,
00055 int n)
00056 {
00057 vgl_point_3d<double> im_p0 = image.world2im()(p0);
00058 vgl_point_3d<double> im_p1 = image.world2im()(p0+u);
00059 int np = image.image().nplanes();
00060 vec.set_size(n*np);
00061 vecType *v = vec.data_block();
00062
00063
00064 double dx = (im_p1.x()-im_p0.x());
00065 double dy = (im_p1.y()-im_p0.y());
00066 double dz = (im_p1.z()-im_p0.z());
00067
00068
00069 vil3d_sample_profile_trilin_extend(v, image.image(),
00070 im_p0.x(),im_p0.y(),im_p0.z(),dx,dy,dz,n);
00071 }
00072
00073
00074
00075
00076
00077
00078 template <class imType, class vecType>
00079 void vimt3d_sample_profile_trilin_edgena(
00080 vnl_vector<vecType>& vec,
00081 const vimt3d_image_3d_of<imType>& image,
00082 const vgl_point_3d<double>& p0,
00083 const vgl_vector_3d<double>& u,
00084 int n)
00085 {
00086 vgl_point_3d<double> im_p0 = image.world2im()(p0);
00087 vgl_point_3d<double> im_p1 = image.world2im()(p0+u);
00088 int np = image.image().nplanes();
00089 vec.set_size(n*np);
00090 vecType *v = vec.data_block();
00091
00092
00093 double dx = (im_p1.x()-im_p0.x());
00094 double dy = (im_p1.y()-im_p0.y());
00095 double dz = (im_p1.z()-im_p0.z());
00096
00097
00098 vil3d_sample_profile_trilin_edgena(v, image.image(),
00099 im_p0.x(),im_p0.y(),im_p0.z(),dx,dy,dz,n);
00100 }
00101
00102 #endif // vimt3d_sample_profile_trilin_h_