code/include/NewWave/PixelArray.hh
Go to the documentation of this file.
00001 #ifndef NEWWAVE_PIXEL_ARRAY_HH 00002 #define NEWWAVE_PIXEL_ARRAY_HH 00003 00004 #include <cassert> 00005 #include <vector> 00006 00007 namespace NewWave{ 00008 using std::vector; 00009 using std::size_t; 00010 00011 class PixelRow{ 00012 00013 public: 00014 00015 PixelRow(){ 00016 00017 } 00018 00019 PixelRow(size_t length): _data(length, 0.), _isEmpty(length, true){ 00020 00021 } 00022 00023 void push_back(double pixel){ 00024 _data.push_back(pixel); 00025 _isEmpty.push_back(false); 00026 return; 00027 } 00028 00029 const double & at(size_t index) const {return _data.at(index);} 00030 double & at(size_t index) {return _data.at(index);} 00031 00032 void clear(){ 00033 _data.clear(); 00034 _isEmpty.clear(); 00035 return; 00036 } 00037 00038 size_t size()const {return _data.size();} 00039 00040 vector<double>::const_iterator begin()const{ return _data.begin();} 00041 vector<double>::const_iterator end()const{ return _data.end();} 00042 00043 friend PixelRow operator / (PixelRow left, const PixelRow &right); 00044 00045 private: 00046 00047 vector<double> _data; 00048 vector<bool> _isEmpty; 00049 00050 }; 00051 00053 00059 inline PixelRow operator / (PixelRow left, const PixelRow &right){ 00060 00061 assert(left._data.size() == right._data.size()); 00062 00063 for(size_t ii=0; ii != left._data.size(); ++ii){ 00064 if(left._isEmpty[ii]) continue; 00065 left._data[ii] /= right._data[ii]; 00066 } 00067 00068 return left; 00069 } 00070 00071 typedef vector<PixelRow> PixelArray; 00072 } 00073 00074 #endif Generated on Wed Aug 23 2017 12:59:15 for New Wave - Noise Elimination With Wavelets At Vast Energies by 1.7.6.1 |