contrib/tbl/vipl/vipl_with_vnl_matrix/accessors/vipl_accessors_vnl_vector.txx
Go to the documentation of this file.
00001 #ifndef vipl_accessors_vnl_vector_txx_
00002 #define vipl_accessors_vnl_vector_txx_
00003 
00004 #include "vipl_accessors_vnl_vector.h"
00005 #include "../vipl_filterable_section_container_generator_vnl_vector.txx"
00006 #include <vcl_cassert.h>
00007 
00008 template <class DataType>
00009 DataType fgetpixel(vnl_vector<DataType> const& i, int x, int y, DataType /* dummy */)
00010 {
00011   assert(y==0);
00012   return i(x);
00013 }
00014 template <class DataType>
00015 void fsetpixel(vnl_vector<DataType>& i, int x, int y, DataType e) {
00016   assert(y==0);
00017   i(x) = e;
00018 }
00019 template <class DataType>
00020 DataType getpixel(vnl_vector<DataType> const& i, int x, int y, DataType /* dummy */) {
00021   if (x<0 || (unsigned)x>=i.size() || y!=0) return DataType();
00022   return i(x);
00023 }
00024 template <class DataType>
00025 void setpixel(vnl_vector<DataType>& i, int x, int y, DataType e) {
00026   if (x<0 || (unsigned)x>=i.size() || y!=0) return;
00027   i(x) = e;
00028 }
00029 
00030 #undef VIPL_INSTANTIATE_ACCESSORS
00031 #define VIPL_INSTANTIATE_ACCESSORS(T) \
00032 template T fgetpixel(vnl_vector<T > const&, int, int, T);\
00033 template void fsetpixel(vnl_vector<T >&, int, int, T);\
00034 template T getpixel(vnl_vector<T > const&, int, int, T);\
00035 template void setpixel(vnl_vector<T >&, int, int, T)
00036 
00037 #endif // vipl_accessors_vnl_vector_txx_