OTB  10.0.0
Orfeo Toolbox
otbSatelliteRSR.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbSatelliteRSR_h
22 #define otbSatelliteRSR_h
23 
24 #include <vector>
25 #include <utility>
26 #include <limits>
27 
28 #include "otbSpectralResponse.h"
29 
30 namespace otb
31 {
47 template <class TPrecision = double, class TValuePrecision = double>
48 class SatelliteRSR : public itk::DataObject
49 {
50 public:
52  typedef SatelliteRSR Self;
53  typedef itk::DataObject Superclass;
54  typedef itk::SmartPointer<Self> Pointer;
55  typedef itk::SmartPointer<const Self> ConstPointer;
56 
58  itkNewMacro(Self);
59  ;
60  itkTypeMacro(SatelliteRSR, DataObject);
61  ;
63 
66  itkGetConstMacro(NbBands, unsigned int);
67  ;
68  itkSetMacro(NbBands, unsigned int);
69  ;
71 
72  itkSetMacro(SortBands, bool);
73  ;
74 
76  typedef TPrecision PrecisionType;
77  typedef TValuePrecision ValuePrecisionType;
78 
81  typedef std::vector<SpectralResponsePointerType> RSRVectorType;
83 
85  virtual bool Clear();
86 
88  virtual int Size() const;
89 
91  void Load(const std::string& filename, ValuePrecisionType coefNormalization = 1.0);
92 
94  void Load(PrecisionType lambdaMin, PrecisionType lambdaMax, PrecisionType sampling, ValuePrecisionType coefNormalization = 1.0);
95 
97  struct sort_band
98  {
100  {
101  PrecisionType aFirstNotNull;
102  PrecisionType bFirstNotNull;
104 
105  typename VectorPairType::const_iterator it = a->GetResponse().begin();
106 
107  while ((*it).second == 0)
108  {
109  ++it;
110  }
111  aFirstNotNull = (*it).first;
112 
113  typename VectorPairType::const_iterator it2 = b->GetResponse().begin();
114 
115  while ((*it2).second == 0)
116  {
117  ++it2;
118  }
119  bFirstNotNull = (*it2).first;
120 
121  return aFirstNotNull < bFirstNotNull;
122  }
123  };
124 
130  inline ValuePrecisionType operator()(const PrecisionType& lambda, const unsigned int numBand);
131 
133  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
134 
137  {
138  return m_RSR;
139  }
140 
143  {
144  return m_SolarIrradiance;
145  }
146 
147 protected:
149  SatelliteRSR();
150 
152  // SatelliteRSR( const std::string & filename );
153 
155  ~SatelliteRSR() override{};
156 
158 
159 private:
160  SatelliteRSR(const Self&) = delete;
161  void operator=(const Self&) = delete;
162 
165 
168 
170  unsigned int m_NbBands;
171 };
172 
173 } // end namespace otb
174 
175 
176 #ifndef OTB_MANUAL_INSTANTIATION
177 #include "otbSatelliteRSR.hxx"
178 #endif
179 
180 #endif
This class represents a hierarchy of vector data.
itk::SmartPointer< const Self > ConstPointer
SpectralResponse< TPrecision, TValuePrecision > SpectralResponseType
TPrecision PrecisionType
virtual bool Clear()
SatelliteRSR Self
void Load(const std::string &filename, ValuePrecisionType coefNormalization=1.0)
ValuePrecisionType operator()(const PrecisionType &lambda, const unsigned int numBand)
RSRVectorType m_RSR
itk::SmartPointer< Self > Pointer
virtual int Size() const
void operator=(const Self &)=delete
void PrintSelf(std::ostream &os, itk::Indent indent) const override
SpectralResponseType::Pointer SpectralResponsePointerType
std::vector< SpectralResponsePointerType > RSRVectorType
SpectralResponseType * GetSolarIrradiance()
SatelliteRSR(const Self &)=delete
itk::DataObject Superclass
~SatelliteRSR() override
SpectralResponsePointerType m_SolarIrradiance
unsigned int m_NbBands
RSRVectorType & GetRSR()
TValuePrecision ValuePrecisionType
SpectralResponseType::VectorPairType VectorPairType
This class represents the spectral response of an object (or a satellite band).
itk::SmartPointer< Self > Pointer
std::vector< PairType > VectorPairType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
bool operator()(SpectralResponsePointerType a, SpectralResponsePointerType b)