Go to the documentation of this file.00001
00002 #ifndef bbgm_planes_to_sample_h_
00003 #define bbgm_planes_to_sample_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <vcl_cstddef.h>
00016
00017 template <class T1, class T2, unsigned n>
00018 struct bbgm_planes_to_sample
00019 {
00020 static void apply(const T1* data, T2& sample, vcl_ptrdiff_t step){
00021 typename T2::iterator s_itr = sample.begin();
00022 for (unsigned int p=0; p<n; ++p, data += step, ++s_itr){
00023 *s_itr = *data;
00024 }
00025 }
00026 };
00027
00028 template <class T1, class T2>
00029 struct bbgm_planes_to_sample<T1,T2,3>
00030 {
00031 static void apply(const T1* data, T2& sample, vcl_ptrdiff_t step){
00032 typename T2::iterator s_itr = sample.begin();
00033 *s_itr = *data;
00034 *(++s_itr) = *(data+=step);
00035 *(++s_itr) = *(data+=step);
00036 }
00037 };
00038
00039 template <class T1, class T2>
00040 struct bbgm_planes_to_sample<T1,T2,1>
00041 {
00042 static void apply(const T1* data, T2& sample, vcl_ptrdiff_t ){
00043 sample = *data;
00044 }
00045 };
00046
00047
00048 #endif // bbgm_planes_to_sample_h_