OTB  9.0.0
Orfeo Toolbox
otbReduceSpectralResponse.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 otbReduceSpectralResponse_h
22 #define otbReduceSpectralResponse_h
23 
24 
25 #include "itkDataObject.h"
26 #include <itkObjectFactory.h>
27 #include <vector>
28 #include <utility>
29 #include <limits>
30 
31 namespace otb
32 {
63 template <class TSpectralResponse, class TRSR>
64 class ReduceSpectralResponse : public itk::DataObject
65 {
66 
67 public:
70  typedef itk::DataObject Superclass;
71  typedef itk::SmartPointer<Self> Pointer;
72  typedef itk::SmartPointer<const Self> ConstPointer;
73 
75  typedef TSpectralResponse InputSpectralResponseType;
76  typedef TRSR InputRSRType;
77 
78  typedef typename InputSpectralResponseType::PairType PairType;
79  typedef typename InputRSRType::Pointer InputRSRPointerType;
80  typedef typename InputSpectralResponseType::Pointer InputSpectralResponsePointerType;
81 
83  typedef typename InputRSRType::ValuePrecisionType ValuePrecisionType;
84 
85  typedef typename InputSpectralResponseType::VectorPairType VectorPairType;
86 
87  // TODO need a specific class for the integration of stectral responses (now it is in the functor)
88  typedef typename InputRSRType::RSRVectorType RSRVectorType;
89  typedef typename std::vector<ValuePrecisionType> ReduceSpectralResponseVectorType;
91  itkNewMacro(Self);
92  ;
93  itkTypeMacro(ReduceSpectralResponse, DataObject);
94  ;
96 
97  itkGetConstObjectMacro(InputSatRSR, InputRSRType);
98  ;
99  itkSetObjectMacro(InputSatRSR, InputRSRType);
100  ;
101 
102  itkGetConstObjectMacro(InputSpectralResponse, InputSpectralResponseType);
103  ;
104  itkSetObjectMacro(InputSpectralResponse, InputSpectralResponseType);
105  ;
106 
109  ;
111 
112  itkSetMacro(ReflectanceMode, bool);
113  itkGetConstMacro(ReflectanceMode, bool);
114 
116  virtual bool Clear();
117 
119  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
120 
125  inline ValuePrecisionType operator()(const unsigned int numBand);
126 
128  void CalculateResponse();
129 
131  void LoadInputsFromFiles(const std::string& spectralResponseFile, const std::string& RSRFile, const unsigned int nbRSRBands,
132  ValuePrecisionType coefNormSpectre = 1.0, ValuePrecisionType coefNormRSR = 1.0);
133 
134 protected:
137 
139  // ReduceSpectralResponse( const std::string & filename );
140 
143 
145  // void PrintSelf(std::ostream& os, itk::Indent indent) const;
146 
149 
152 
153 private:
154  ReduceSpectralResponse(const Self&) = delete;
155  void operator=(const Self&) = delete;
156 
159 
162 };
163 
164 } // end namespace otb
165 
166 
167 #ifndef OTB_MANUAL_INSTANTIATION
169 #endif
170 
171 #endif
otb::ReduceSpectralResponse
This class computes the reduced spectral response of each band of a sensor.
Definition: otbReduceSpectralResponse.h:64
otb::ReduceSpectralResponse::m_ReflectanceMode
bool m_ReflectanceMode
Definition: otbReduceSpectralResponse.h:161
otb::ReduceSpectralResponse::VectorPairType
InputSpectralResponseType::VectorPairType VectorPairType
Definition: otbReduceSpectralResponse.h:85
GapFilling::PrecisionType
double PrecisionType
Definition: otbDateUtils.h:29
otb::ReduceSpectralResponse::PrecisionType
InputRSRType::PrecisionType PrecisionType
Definition: otbReduceSpectralResponse.h:82
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ReduceSpectralResponse::CalculateResponse
void CalculateResponse()
Definition: otbReduceSpectralResponse.hxx:129
otb::ReduceSpectralResponse::RSRVectorType
InputRSRType::RSRVectorType RSRVectorType
Definition: otbReduceSpectralResponse.h:88
otb::ReduceSpectralResponse::Self
ReduceSpectralResponse Self
Definition: otbReduceSpectralResponse.h:69
otb::ReduceSpectralResponse::m_ReduceResponse
InputSpectralResponsePointerType m_ReduceResponse
Definition: otbReduceSpectralResponse.h:158
otb::ReduceSpectralResponse::InputSpectralResponsePointerType
InputSpectralResponseType::Pointer InputSpectralResponsePointerType
Definition: otbReduceSpectralResponse.h:80
otb::ReduceSpectralResponse::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbReduceSpectralResponse.hxx:168
otb::ReduceSpectralResponse::Superclass
itk::DataObject Superclass
Definition: otbReduceSpectralResponse.h:70
otb::ReduceSpectralResponse::~ReduceSpectralResponse
~ReduceSpectralResponse() override
Definition: otbReduceSpectralResponse.h:142
otb::ReduceSpectralResponse::operator=
void operator=(const Self &)=delete
otb::ReduceSpectralResponse::LoadInputsFromFiles
void LoadInputsFromFiles(const std::string &spectralResponseFile, const std::string &RSRFile, const unsigned int nbRSRBands, ValuePrecisionType coefNormSpectre=1.0, ValuePrecisionType coefNormRSR=1.0)
Definition: otbReduceSpectralResponse.hxx:149
otb::ReduceSpectralResponse::ValuePrecisionType
InputRSRType::ValuePrecisionType ValuePrecisionType
Definition: otbReduceSpectralResponse.h:83
otb::ReduceSpectralResponse::itkGetObjectMacro
itkGetObjectMacro(ReduceResponse, InputSpectralResponseType)
otb::ReduceSpectralResponse::operator()
ValuePrecisionType operator()(const unsigned int numBand)
Definition: otbReduceSpectralResponse.hxx:67
otb::ReduceSpectralResponse::PairType
InputSpectralResponseType::PairType PairType
Definition: otbReduceSpectralResponse.h:78
otb::ReduceSpectralResponse::ReduceSpectralResponseVectorType
std::vector< ValuePrecisionType > ReduceSpectralResponseVectorType
Definition: otbReduceSpectralResponse.h:89
otb::ReduceSpectralResponse::InputRSRType
TRSR InputRSRType
Definition: otbReduceSpectralResponse.h:76
otb::ReduceSpectralResponse::ReduceSpectralResponse
ReduceSpectralResponse()
Definition: otbReduceSpectralResponse.hxx:32
otb::ReduceSpectralResponse::m_InputSpectralResponse
InputSpectralResponsePointerType m_InputSpectralResponse
Definition: otbReduceSpectralResponse.h:151
otb::ReduceSpectralResponse::Clear
virtual bool Clear()
Definition: otbReduceSpectralResponse.hxx:38
otb::ReduceSpectralResponse::InputRSRPointerType
InputRSRType::Pointer InputRSRPointerType
Definition: otbReduceSpectralResponse.h:79
otb::ReduceSpectralResponse::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbReduceSpectralResponse.h:72
otb::ReduceSpectralResponse::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbReduceSpectralResponse.h:71
otb::ReduceSpectralResponse::m_InputSatRSR
InputRSRPointerType m_InputSatRSR
Definition: otbReduceSpectralResponse.h:142
otb::ReduceSpectralResponse::InputSpectralResponseType
TSpectralResponse InputSpectralResponseType
Definition: otbReduceSpectralResponse.h:75
otbReduceSpectralResponse.hxx