OTB  9.0.0
Orfeo Toolbox
otbTimeSeries.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbTimeSeries_h
22 #define otbTimeSeries_h
23 
24 #include "itkFixedArray.h"
25 #include <cmath>
26 
27 namespace otb
28 {
29 template <unsigned int TDegree = 2, class TCoefPrecision = double>
31 {
32 public:
33  typedef TCoefPrecision CoefficientsPrecisionType;
34  typedef itk::FixedArray<CoefficientsPrecisionType, TDegree + 1> CoefficientsType;
35 
36 
39  {
40  }
43  {
44  }
45 
46  inline void SetCoefficients(CoefficientsType& coeffs)
47  {
48  for (unsigned int i = 0; i <= TDegree; ++i)
49  m_Coefficients[i] = coeffs[i];
50  }
51 
52  inline TCoefPrecision GetCoefficient(unsigned int co) const
53  {
54  return m_Coefficients[co];
55  }
56 
58  {
59  return m_Coefficients;
60  }
61 
63  {
64  CoefficientsPrecisionType tmpVal = 0;
65  for (unsigned int i = 0; i <= TDegree; ++i)
66  tmpVal += m_Coefficients[i] * std::pow(val, static_cast<CoefficientsPrecisionType>(i));
67  return tmpVal;
68  }
69 
70 private:
72 };
73 }
74 #endif
otb::PolynomialTimeSeries::GetCoefficients
CoefficientsType GetCoefficients() const
Definition: otbTimeSeries.h:57
otb::PolynomialTimeSeries::CoefficientsType
itk::FixedArray< CoefficientsPrecisionType, TDegree+1 > CoefficientsType
Definition: otbTimeSeries.h:34
otb::PolynomialTimeSeries::SetCoefficients
void SetCoefficients(CoefficientsType &coeffs)
Definition: otbTimeSeries.h:46
otb::PolynomialTimeSeries::~PolynomialTimeSeries
virtual ~PolynomialTimeSeries()
Destructor.
Definition: otbTimeSeries.h:42
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::PolynomialTimeSeries::m_Coefficients
CoefficientsType m_Coefficients
Definition: otbTimeSeries.h:71
otb::PolynomialTimeSeries::GetCoefficient
TCoefPrecision GetCoefficient(unsigned int co) const
Definition: otbTimeSeries.h:52
otb::PolynomialTimeSeries::GetValue
CoefficientsPrecisionType GetValue(CoefficientsPrecisionType val) const
Definition: otbTimeSeries.h:62
otb::PolynomialTimeSeries::CoefficientsPrecisionType
TCoefPrecision CoefficientsPrecisionType
Definition: otbTimeSeries.h:33
otb::PolynomialTimeSeries::PolynomialTimeSeries
PolynomialTimeSeries()
Constructor.
Definition: otbTimeSeries.h:38
otb::PolynomialTimeSeries
Definition: otbTimeSeries.h:30