Commit 3810c87c7c7fc99fd94ecb7b4b25d4e431369857

Authored by Jordi Inglada
1 parent 7c1627ae

REFAC: add const

Showing 1 changed file with 9 additions and 9 deletions   Show diff stats
include/iota2FeatureExtraction.h
... ... @@ -103,12 +103,12 @@ public:
103 103 m_CopyInputBands{pars.CopyInputBands}
104 104 {
105 105 m_NumberOfDates = m_NumberOfInputComponents/m_ComponentsPerDate;
106   - auto numberOfOutputFeatures = m_NumberOfFeatures-
  106 + const auto numberOfOutputFeatures = m_NumberOfFeatures-
107 107 ((m_RelativeReflectances&&m_RemoveDuplicates)?1:0);
108 108 m_NumberOfOutputComponents = ( numberOfOutputFeatures +
109 109 (m_CopyInputBands?
110 110 m_ComponentsPerDate:0))*m_NumberOfDates;
111   - auto max_index_band = std::max({m_RedIndex, m_NIRIndex, m_SWIRIndex});
  111 + const auto max_index_band = std::max({m_RedIndex, m_NIRIndex, m_SWIRIndex});
112 112 if(max_index_band > m_ComponentsPerDate)
113 113 throw std::domain_error("Band indices and components per date are not coherent.");
114 114 };
... ... @@ -119,8 +119,8 @@ public:
119 119 throw std::domain_error("Pixel size incoherent with number of components per date.");
120 120 PixelType result(m_NumberOfOutputComponents);
121 121 //use std vectors instead of pixels
122   - auto inVec = VectorType(p.GetDataPointer(),
123   - p.GetDataPointer()+p.GetSize());
  122 + const auto inVec = VectorType(p.GetDataPointer(),
  123 + p.GetDataPointer()+p.GetSize());
124 124 //copy the spectral bands
125 125 auto outVec = VectorType(m_NumberOfOutputComponents);
126 126 //copy the input reflectances
... ... @@ -207,14 +207,14 @@ protected:
207 207 else
208 208 {
209 209 //compute the features
210   - auto red = *(inIt+m_RedIndex-1);
211   - auto nir = *(inIt+m_NIRIndex-1);
212   - auto swir = *(inIt+m_SWIRIndex-1);
  210 + const auto red = *(inIt+m_RedIndex-1);
  211 + const auto nir = *(inIt+m_NIRIndex-1);
  212 + const auto swir = *(inIt+m_SWIRIndex-1);
213 213 VectorType tmpVec(m_ComponentsPerDate);
214 214 std::transform(inIt, inIt+m_ComponentsPerDate,tmpVec.begin(),
215 215 [](decltype(*inIt)x){ return x*x;});
216   - auto brightness = std::sqrt(std::accumulate(tmpVec.begin(), tmpVec.end(),
217   - ValueType{0}));
  216 + const auto brightness = std::sqrt(std::accumulate(tmpVec.begin(), tmpVec.end(),
  217 + ValueType{0}));
218 218 //append the features
219 219 size_t featureOffset{0};
220 220 //ndvi
... ...