Go to the documentation of this file.00001 #ifndef mfpf_sample_region_h_
00002 #define mfpf_sample_region_h_
00003
00004
00005
00006
00007
00008
00009 #include <mbl/mbl_chord.h>
00010 #include <vnl/vnl_vector.h>
00011 #include <vcl_vector.h>
00012 #include <vcl_cstddef.h>
00013
00014
00015
00016
00017 template <class T>
00018 inline void mfpf_sample_region(const T* image,
00019 vcl_ptrdiff_t jstep, unsigned np,
00020 const vcl_vector<mbl_chord>& roi,
00021 vnl_vector<double>& vec)
00022 {
00023 double *v = vec.data_block();
00024 vcl_vector<mbl_chord>::const_iterator c=roi.begin();
00025 for (;c!=roi.end();++c)
00026 {
00027 const T* im_row = image+c->y()*jstep;
00028 const T* pix = im_row + c->start_x()*np;
00029 const T* pix_end = im_row+(c->end_x()+1)*np;
00030 for (;pix!=pix_end;++pix,++v) *v=double(*pix);
00031 }
00032 }
00033
00034 #endif // #define mfpf_sample_region_h_