Go to the documentation of this file.00001 #ifndef vipl_accessors_vil_image_view_txx_
00002 #define vipl_accessors_vil_image_view_txx_
00003
00004 #include "vipl_accessors_vil_image_view.h"
00005 #include <vipl/section/vipl_filterable_section_container_generator_vil_image_view.txx>
00006
00007 template <class DataType>
00008 DataType fgetpixel(vil_image_view<DataType> const& i, int x, int y, DataType )
00009 {
00010 return i(x,y);
00011 }
00012
00013 template <class DataType>
00014 void fsetpixel(vil_image_view<DataType>& i, int x, int y, DataType e)
00015 {
00016 i(x,y) = e;
00017 }
00018
00019 template <class DataType>
00020 DataType getpixel(vil_image_view<DataType> const& i, int x, int y, DataType )
00021 {
00022 if (x<0 || y<0 || x>=int(i.ni()) || y>=int(i.nj())) return DataType();
00023 return i(x,y);
00024 }
00025
00026 template <class DataType>
00027 void setpixel(vil_image_view<DataType>& i, int x, int y, DataType e)
00028 {
00029 if (x<0 || y<0 || x>=int(i.ni()) || y>=int(i.nj())) return;
00030 i(x,y) = e;
00031 }
00032
00033 #undef VIPL_INSTANTIATE_ACCESSORS
00034 #define VIPL_INSTANTIATE_ACCESSORS(T) \
00035 template T fgetpixel(vil_image_view<T > const&, int, int, T);\
00036 template void fsetpixel(vil_image_view<T >&, int, int, T);\
00037 template T getpixel(vil_image_view<T > const&, int, int, T);\
00038 template void setpixel(vil_image_view<T >&, int, int, T)
00039
00040 #endif // vipl_accessors_vil_image_view_txx_