Go to the documentation of this file.00001
00002 #ifndef vil3d_plane_h_
00003 #define vil3d_plane_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011 #include <vil3d/vil3d_image_view.h>
00012 #include <vcl_cassert.h>
00013
00014
00015
00016
00017
00018 template<class T>
00019 inline vil3d_image_view<T> vil3d_plane(const vil3d_image_view<T> &im, unsigned p)
00020 {
00021 assert(p<im.nplanes());
00022 return vil3d_image_view<T>(im.memory_chunk(),
00023 im.origin_ptr()+p*im.planestep(),
00024 im.ni(),im.nj(),im.nk(),1,
00025 im.istep(),im.jstep(),im.kstep(),im.planestep());
00026 }
00027
00028
00029
00030
00031
00032
00033
00034
00035 template<class T>
00036 inline vil3d_image_view<T> vil3d_planes(const vil3d_image_view<T> &im,
00037 unsigned first, int skip,
00038 unsigned n)
00039 {
00040 assert(first<im.nplanes());
00041 #ifndef NDEBUG
00042 int end = first + n*skip;
00043 assert(end >= 0);
00044 assert((unsigned)end <= im.nplanes());
00045 #endif // NDEBUG
00046 return vil3d_image_view<T>(im.memory_chunk(),
00047 im.origin_ptr()+first*im.planestep(), im.ni(), im.nj(), im.nk(), n,
00048 im.istep(),im.jstep(),im.kstep(), skip*im.planestep());
00049 }
00050
00051
00052 #endif // vil3d_plane_h_