OTB  10.0.0
Orfeo Toolbox
otbReflectanceToSurfaceReflectanceImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbReflectanceToSurfaceReflectanceImageFilter_h
23 #define otbReflectanceToSurfaceReflectanceImageFilter_h
24 
26 
29 
30 #include "otbMacro.h"
31 #include "itkMetaDataDictionary.h"
32 
33 #include <iomanip>
34 
35 namespace otb
36 {
37 namespace Functor
38 {
49 template <class TInput, class TOutput>
51 {
52 public:
54  {
55  m_Coefficient = 1.;
56  m_Residu = 1.;
57  m_SphericalAlbedo = 1.;
58  }
60  {
61  }
63 
67  void SetSphericalAlbedo(double albedo)
68  {
69  m_SphericalAlbedo = albedo;
70  }
72  {
73  return m_SphericalAlbedo;
74  }
76 
80  void SetCoefficient(double coef)
81  {
82  m_Coefficient = coef;
83  }
84  double GetCoefficient()
85  {
86  return m_Coefficient;
87  }
89 
93  void SetResidu(double res)
94  {
95  m_Residu = res;
96  }
97  double GetResidu()
98  {
99  return m_Residu;
100  }
102 
103  inline TOutput operator()(const TInput& inPixel)
104  {
105  TOutput outPixel;
106  double temp, temp2;
107  temp = (static_cast<double>(inPixel) + m_Residu) * m_Coefficient;
108  temp2 = temp / (1. + m_SphericalAlbedo * temp);
109 
110  outPixel = static_cast<TOutput>(temp2);
111 
112  return outPixel;
113  }
114 
115 private:
118  double m_Residu;
119 };
120 }
121 
138 template <class TInputImage, class TOutputImage>
141  TInputImage, TOutputImage,
142  typename Functor::ReflectanceToSurfaceReflectanceImageFunctor<typename TInputImage::InternalPixelType, typename TOutputImage::InternalPixelType>>
143 {
144 public:
146  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
147  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
149 
151  typedef TInputImage InputImageType;
152  typedef TOutputImage OutputImageType;
153 
159  typedef itk::SmartPointer<Self> Pointer;
160  typedef itk::SmartPointer<const Self> ConstPointer;
161 
163  itkNewMacro(Self);
164 
167 
169  typedef typename InputImageType::PixelType InputPixelType;
170  typedef typename InputImageType::InternalPixelType InputInternalPixelType;
171  typedef typename InputImageType::RegionType InputImageRegionType;
172  typedef typename OutputImageType::PixelType OutputPixelType;
173  typedef typename OutputImageType::InternalPixelType OutputInternalPixelType;
174  typedef typename OutputImageType::RegionType OutputImageRegionType;
175 
176 
178 
181 
184 
187 
188 
192 
194 
195 
196  typedef itk::MetaDataDictionary MetaDataDictionaryType;
197 
200  {
201  m_AtmosphericRadiativeTerms = atmoRadTerms;
202  this->SetNthInput(1, m_AtmosphericRadiativeTerms);
203  m_IsSetAtmosphericRadiativeTerms = true;
204  this->Modified();
205  }
208 
211  {
212  m_AtmoCorrectionParameters = atmoCorrTerms;
213  this->SetNthInput(2, m_AtmoCorrectionParameters);
214  m_IsSetAtmoCorrectionParameters = true;
215  this->Modified();
216  }
219 
222  {
223  m_AcquiCorrectionParameters = acquiCorrTerms;
224  this->SetNthInput(3, m_AcquiCorrectionParameters);
225  m_IsSetAcquiCorrectionParameters = true;
226  this->Modified();
227  }
230 
231 
233  void GenerateParameters();
234 
236  itkSetMacro(UseGenerateParameters, bool);
237  itkGetMacro(UseGenerateParameters, bool);
238  itkBooleanMacro(UseGenerateParameters);
240 
242  itkSetMacro(IsSetAtmosphericRadiativeTerms, bool);
243  itkGetMacro(IsSetAtmosphericRadiativeTerms, bool);
244  itkBooleanMacro(IsSetAtmosphericRadiativeTerms);
246 
247 protected:
250 
253  {
254  }
255  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
256 
258  void BeforeThreadedGenerateData() override;
259 
261  void UpdateAtmosphericRadiativeTerms();
262 
264  void UpdateFunctors();
265 
267  void Modified() const override;
268 
269 private:
273 
278 
281 
285 };
286 
287 } // end namespace otb
288 
289 #ifndef OTB_MANUAL_INSTANTIATION
291 #endif
292 
293 #endif
This class contains all atmospheric correction parameters.
This class is a vector of AtmosphericRadiativeTermsSingleChannel, it contains all atmospheric radiati...
This class contains the values of the filter function for the processed spectral band.
std::vector< WavelengthSpectralBandType > ValuesVectorType
Compute the surface reflectance pixel from a TOA reflectance.
This class contains all atmospheric correction parameters.
InternalWavelengthSpectralBandVectorType::Pointer WavelengthSpectralBandVectorType
Calculates the slope, the orientation incidence and exitance radius values for each pixel.
FilterFunctionValuesType::WavelengthSpectralBandType ValueType
AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType
Functor::ReflectanceToSurfaceReflectanceImageFunctor< typename InputImageType::InternalPixelType, typename OutputImageType::InternalPixelType > FunctorType
void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmoRadTerms)
otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType
itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType)
void SetAcquiCorrectionParameters(AcquiCorrectionParametersPointerType acquiCorrTerms)
itkGetObjectMacro(AtmoCorrectionParameters, AtmoCorrectionParametersType)
UnaryImageFunctorWithVectorImageFilter< InputImageType, OutputImageType, FunctorType > Superclass
itkGetObjectMacro(AcquiCorrectionParameters, AcquiCorrectionParametersType)
void SetAtmoCorrectionParameters(AtmoCorrectionParametersPointerType atmoCorrTerms)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.