00001 #ifndef vil3d_resample_tricubic_h_ 00002 #define vil3d_resample_tricubic_h_ 00003 //: 00004 // \file 00005 // \brief Resample a 3D image by a tricubic method 00006 // \author Gwenael Guillard 00007 00008 #include <vil3d/vil3d_image_view.h> 00009 00010 00011 //: Sample grid of points in one image and place in another, using tricubic interpolation. 00012 // dest_image(i,j,k,p) is sampled from the src_image at 00013 // (x0+i.dx1+j.dx2+k.dx3, y0+i.dy1+j.dy2+k.dy3, z0+i.dz1+j.dz2+k.dz3), 00014 // where i=[0..n1-1], j=[0..n2-1], k=[0..n3-1]. 00015 // dest_image resized to (n1,n2,n3,src_image.nplanes()) 00016 // Points outside interpolatable region return zero or \a outval 00017 template <class S, class T> 00018 void vil3d_resample_tricubic(const vil3d_image_view<S>& src_image, 00019 vil3d_image_view<T>& dest_image, 00020 double x0, double y0, double z0, 00021 double dx1, double dy1, double dz1, 00022 double dx2, double dy2, double dz2, 00023 double dx3, double dy3, double dz3, 00024 int n1, int n2, int n3, 00025 T outval=0); 00026 00027 00028 //: Sample grid of points in one image and place in another, using tricubic interpolation and edge extension. 00029 // dest_image(i,j,k,p) is sampled from the src_image at 00030 // (x0+i.dx1+j.dx2+k.dx3, y0+i.dy1+j.dy2+k.dy3, z0+i.dz1+j.dz2+k.dz3), 00031 // where i=[0..n1-1], j=[0..n2-1], k=[0..n3-1]. 00032 // dest_image resized to (n1,n2,n3,src_image.nplanes()) 00033 // Points outside interpolatable return the value of the nearest valid pixel. 00034 template <class S, class T> 00035 void vil3d_resample_tricubic_edge_extend(const vil3d_image_view<S>& src_image, 00036 vil3d_image_view<T>& dest_image, 00037 double x0, double y0, double z0, 00038 double dx1, double dy1, double dz1, 00039 double dx2, double dy2, double dz2, 00040 double dx3, double dy3, double dz3, 00041 int n1, int n2, int n3); 00042 00043 //: Sample grid of points in one image and place in another, using tricubic interpolation and edge extension. 00044 // dest_image(i,j,k,p) is sampled from the src_image at 00045 // (x0+i.dx1+j.dx2+k.dx3, y0+i.dy1+j.dy2+k.dy3, z0+i.dz1+j.dz2+k.dz3), 00046 // where i=[0..n1-1], j=[0..n2-1], k=[0..n3-1]. 00047 // dest_image resized to (n1,n2,n3,src_image.nplanes()) 00048 // Points outside interpolatable return the value of the nearest valid pixel. 00049 template <class S, class T> 00050 void vil3d_resample_tricubic_edge_extend(const vil3d_image_view<S>& src_image, 00051 vil3d_image_view<T>& dest_image, 00052 int n1, int n2, int n3); 00053 00054 //: Sample grid of points in one image and place in another, using tricubic interpolation. 00055 // dest_image(i,j,k,p) is sampled from the src_image at 00056 // (x0+i.dx1+j.dx2+k.dx3, y0+i.dy1+j.dy2+k.dy3, z0+i.dz1+j.dz2+k.dz3), 00057 // where i=[0..n1-1], j=[0..n2-1], k=[0..n3-1] 00058 // dest_image resized to (n1,n2,n3,src_image.nplanes()) 00059 // Points outside interpolatable return the trilinear interpolated value of the nearest valid pixels. 00060 template <class S, class T> 00061 void vil3d_resample_tricubic_edge_trilin_extend(const vil3d_image_view<S>& src_image, 00062 vil3d_image_view<T>& dest_image, 00063 double x0, double y0, double z0, 00064 double dx1, double dy1, double dz1, 00065 double dx2, double dy2, double dz2, 00066 double dx3, double dy3, double dz3, 00067 int n1, int n2, int n3); 00068 00069 //: Sample grid of points in one image and place in another, using tricubic interpolation. 00070 // dest_image(i,j,k,p) is sampled from the src_image at 00071 // (x0+i.dx1+j.dx2+k.dx3, y0+i.dy1+j.dy2+k.dy3, z0+i.dz1+j.dz2+k.dz3), 00072 // where i=[0..n1-1], j=[0..n2-1], k=[0..n3-1] 00073 // dest_image resized to (n1,n2,n3,src_image.nplanes()) 00074 // Points outside interpolatable return the trilinear interpolated value of the nearest valid pixels. 00075 template <class S, class T> 00076 void vil3d_resample_tricubic_edge_trilin_extend(const vil3d_image_view<S>& src_image, 00077 vil3d_image_view<T>& dest_image, 00078 int n1, int n2, int n3); 00079 00080 //: Resample image to a specified dimensions (n1 * n2 * n3) 00081 template <class S, class T> 00082 void vil3d_resample_tricubic(const vil3d_image_view<S>& src_image, 00083 vil3d_image_view<T>& dest_image, 00084 int n1, int n2, int n3); 00085 00086 00087 #endif // vil3d_resample_tricubic_h_