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