Go to the documentation of this file.00001
00002 #ifndef vil_copy_txx_
00003 #define vil_copy_txx_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma implementation
00006 #endif
00007
00008
00009
00010
00011
00012 #include "vil_copy.h"
00013 #include <vcl_cassert.h>
00014 #include <vil/vil_image_view.h>
00015
00016
00017 template<class T>
00018 void vil_copy_deep(const vil_image_view<T> &src, vil_image_view<T> &dest)
00019 {
00020 dest.deep_copy(src);
00021 }
00022
00023
00024 template<class T>
00025 vil_image_view<T> vil_copy_deep(const vil_image_view<T> &src)
00026 {
00027 vil_image_view<T> cpy;
00028 cpy.deep_copy(src);
00029 return cpy;
00030 }
00031
00032
00033
00034
00035
00036 template<class T>
00037 void vil_copy_reformat(const vil_image_view<T> &src, vil_image_view<T> &dest)
00038 {
00039 assert (src.nplanes() == dest.nplanes() &&
00040 src.nj() == dest.nj() &&
00041 src.ni() == dest.ni());
00042 for (unsigned p = 0; p < dest.nplanes(); ++p)
00043 for (unsigned j = 0; j < dest.nj(); ++j)
00044 for (unsigned i = 0; i < dest.ni(); ++i)
00045 dest(i,j,p) = src(i,j,p);
00046 }
00047
00048
00049
00050
00051
00052 template<class T>
00053 void vil_copy_to_window(const vil_image_view<T> &src, vil_image_view<T> &dest,
00054 unsigned i0, unsigned j0)
00055 {
00056
00057 assert(i0+src.ni() <= dest.ni() && j0+src.nj() <= dest.nj());
00058 assert (src.nplanes() == dest.nplanes());
00059
00060 for (unsigned p = 0; p < dest.nplanes(); ++p)
00061 for (unsigned j = 0; j < src.nj(); ++j)
00062 for (unsigned i = 0; i < src.ni(); ++i)
00063 dest(i+i0,j+j0,p) = src(i,j,p);
00064 }
00065
00066
00067
00068 #define VIL_COPY_INSTANTIATE(T) \
00069 template void vil_copy_deep(const vil_image_view<T > &src, vil_image_view<T > &dest); \
00070 template void vil_copy_to_window(const vil_image_view<T > &src, vil_image_view<T > &dest, \
00071 unsigned i0, unsigned j0); \
00072 template void vil_copy_reformat(const vil_image_view<T > &src, vil_image_view<T > &dest); \
00073 template vil_image_view<T > vil_copy_deep(const vil_image_view<T > &rhs)
00074
00075 #endif // vil_copy_txx_