OTB  9.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-2022 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  }
206  itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType);
208 
211  {
212  m_AtmoCorrectionParameters = atmoCorrTerms;
213  this->SetNthInput(2, m_AtmoCorrectionParameters);
214  m_IsSetAtmoCorrectionParameters = true;
215  this->Modified();
216  }
217  itkGetObjectMacro(AtmoCorrectionParameters, AtmoCorrectionParametersType);
219 
222  {
223  m_AcquiCorrectionParameters = acquiCorrTerms;
224  this->SetNthInput(3, m_AcquiCorrectionParameters);
225  m_IsSetAcquiCorrectionParameters = true;
226  this->Modified();
227  }
228  itkGetObjectMacro(AcquiCorrectionParameters, AcquiCorrectionParametersType);
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
otb::ReflectanceToSurfaceReflectanceImageFilter::CorrectionParametersToRadiativeTermsType
otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:177
otb::ReflectanceToSurfaceReflectanceImageFilter::m_IsSetAtmosphericRadiativeTerms
bool m_IsSetAtmosphericRadiativeTerms
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:270
otb::ReflectanceToSurfaceReflectanceImageFilter::InputInternalPixelType
InputImageType::InternalPixelType InputInternalPixelType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:170
otbReflectanceToSurfaceReflectanceImageFilter.hxx
otb::ReflectanceToSurfaceReflectanceImageFilter::m_IsSetAcquiCorrectionParameters
bool m_IsSetAcquiCorrectionParameters
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:272
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::~ReflectanceToSurfaceReflectanceImageFunctor
virtual ~ReflectanceToSurfaceReflectanceImageFunctor()
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:59
otb::AtmosphericRadiativeTerms
This class is a vector of AtmosphericRadiativeTermsSingleChannel, it contains all atmospheric radiati...
Definition: otbAtmosphericRadiativeTerms.h:185
otb::ReflectanceToSurfaceReflectanceImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:174
otb::ReflectanceToSurfaceReflectanceImageFilter::WavelengthSpectralBandVectorType
AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:193
otb::ReflectanceToSurfaceReflectanceImageFilter::FunctorType
Functor::ReflectanceToSurfaceReflectanceImageFunctor< typename InputImageType::InternalPixelType, typename OutputImageType::InternalPixelType > FunctorType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:155
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::m_Residu
double m_Residu
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:118
otb::ReflectanceToSurfaceReflectanceImageFilter::~ReflectanceToSurfaceReflectanceImageFilter
~ReflectanceToSurfaceReflectanceImageFilter() override
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:252
otb::ImageMetadataCorrectionParameters::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImageMetadataCorrectionParameters.h:52
otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms
TODO.
Definition: otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h:41
otb::ReflectanceToSurfaceReflectanceImageFilter::AtmosphericRadiativeTermsPointerType
AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:186
otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h
otb::ReflectanceToSurfaceReflectanceImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:171
otb::ReflectanceToSurfaceReflectanceImageFilter::SetAtmoCorrectionParameters
void SetAtmoCorrectionParameters(AtmoCorrectionParametersPointerType atmoCorrTerms)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:210
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor
Compute the surface reflectance pixel from a TOA reflectance.
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:50
otb::ReflectanceToSurfaceReflectanceImageFilter::InputPixelType
InputImageType::PixelType InputPixelType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:166
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ReflectanceToSurfaceReflectanceImageFilter::SetAcquiCorrectionParameters
void SetAcquiCorrectionParameters(AcquiCorrectionParametersPointerType acquiCorrTerms)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:221
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::SetCoefficient
void SetCoefficient(double coef)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:80
otb::ReflectanceToSurfaceReflectanceImageFilter
Calculates the slope, the orientation incidence and exitance radius values for each pixel.
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:139
otbMacro.h
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::GetResidu
double GetResidu()
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:97
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::GetSphericalAlbedo
double GetSphericalAlbedo()
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:71
otb::ReflectanceToSurfaceReflectanceImageFilter::Self
ReflectanceToSurfaceReflectanceImageFilter Self
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:157
otb::FilterFunctionValues
This class contains the values of the filter function for the processed spectral band.
Definition: otbFilterFunctionValues.h:44
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::SetResidu
void SetResidu(double res)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:93
otb::ReflectanceToSurfaceReflectanceImageFilter::FilterFunctionValuesType
otb::FilterFunctionValues FilterFunctionValuesType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:189
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::SetSphericalAlbedo
void SetSphericalAlbedo(double albedo)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:67
otb::UnaryImageFunctorWithVectorImageFilter
Applies a functor to a VectorImage.
Definition: otbUnaryImageFunctorWithVectorImageFilter.h:46
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::GetCoefficient
double GetCoefficient()
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:84
otb::ReflectanceToSurfaceReflectanceImageFilter::ValuesVectorType
FilterFunctionValuesType::ValuesVectorType ValuesVectorType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:191
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::operator()
TOutput operator()(const TInput &inPixel)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:103
otb::ReflectanceToSurfaceReflectanceImageFilter::Superclass
UnaryImageFunctorWithVectorImageFilter< InputImageType, OutputImageType, FunctorType > Superclass
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:158
otb::ReflectanceToSurfaceReflectanceImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:160
otb::FilterFunctionValues::WavelengthSpectralBandType
float WavelengthSpectralBandType
Definition: otbFilterFunctionValues.h:57
otb::ReflectanceToSurfaceReflectanceImageFilter::m_IsSetAtmoCorrectionParameters
bool m_IsSetAtmoCorrectionParameters
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:271
otb::AtmosphericRadiativeTerms::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbAtmosphericRadiativeTerms.h:191
otb::ReflectanceToSurfaceReflectanceImageFilter::m_FunctorParametersHaveBeenComputed
bool m_FunctorParametersHaveBeenComputed
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:280
otb::ReflectanceToSurfaceReflectanceImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:152
otb::AtmosphericCorrectionParameters::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbAtmosphericCorrectionParameters.h:52
otbUnaryImageFunctorWithVectorImageFilter.h
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::ReflectanceToSurfaceReflectanceImageFunctor
ReflectanceToSurfaceReflectanceImageFunctor()
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:53
otb::ImageMetadataCorrectionParameters
This class contains all atmospheric correction parameters.
Definition: otbImageMetadataCorrectionParameters.h:46
otb::ImageMetadataCorrectionParameters::WavelengthSpectralBandVectorType
InternalWavelengthSpectralBandVectorType::Pointer WavelengthSpectralBandVectorType
Definition: otbImageMetadataCorrectionParameters.h:62
otb::ReflectanceToSurfaceReflectanceImageFilter::AtmosphericRadiativeTermsType
otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:185
otb::ReflectanceToSurfaceReflectanceImageFilter::m_AcquiCorrectionParameters
AcquiCorrectionParametersPointerType m_AcquiCorrectionParameters
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:284
otb::ReflectanceToSurfaceReflectanceImageFilter::m_AtmoCorrectionParameters
AtmoCorrectionParametersPointerType m_AtmoCorrectionParameters
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:283
otb::ReflectanceToSurfaceReflectanceImageFilter::m_AtmosphericRadiativeTerms
AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:282
otb::AtmosphericCorrectionParameters
This class contains all atmospheric correction parameters.
Definition: otbAtmosphericCorrectionParameters.h:46
otb::ReflectanceToSurfaceReflectanceImageFilter::SetAtmosphericRadiativeTerms
void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmoRadTerms)
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:199
otbAtmosphericCorrectionParameters.h
otb::ReflectanceToSurfaceReflectanceImageFilter::AcquiCorrectionParametersType
otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:182
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::m_SphericalAlbedo
double m_SphericalAlbedo
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:116
otb::ReflectanceToSurfaceReflectanceImageFilter::OutputInternalPixelType
OutputImageType::InternalPixelType OutputInternalPixelType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:173
otb::ReflectanceToSurfaceReflectanceImageFilter::AtmoCorrectionParametersPointerType
AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:180
otb::ReflectanceToSurfaceReflectanceImageFilter::m_UseGenerateParameters
bool m_UseGenerateParameters
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:277
otb::ReflectanceToSurfaceReflectanceImageFilter::OutputPixelType
OutputImageType::PixelType OutputPixelType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:172
otb::Functor::ReflectanceToSurfaceReflectanceImageFunctor::m_Coefficient
double m_Coefficient
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:117
otb::ReflectanceToSurfaceReflectanceImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:159
otb::ReflectanceToSurfaceReflectanceImageFilter::AcquiCorrectionParametersPointerType
AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:183
otb::ReflectanceToSurfaceReflectanceImageFilter::InputImageType
TInputImage InputImageType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:151
otb::ReflectanceToSurfaceReflectanceImageFilter::ValueType
FilterFunctionValuesType::WavelengthSpectralBandType ValueType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:190
otb::FilterFunctionValues::ValuesVectorType
std::vector< WavelengthSpectralBandType > ValuesVectorType
Definition: otbFilterFunctionValues.h:60
otb::ReflectanceToSurfaceReflectanceImageFilter::MetaDataDictionaryType
itk::MetaDataDictionary MetaDataDictionaryType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:196
otb::ReflectanceToSurfaceReflectanceImageFilter::AtmoCorrectionParametersType
otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType
Definition: otbReflectanceToSurfaceReflectanceImageFilter.h:179