22 #ifndef otbReflectanceToImageImageFilter_h
23 #define otbReflectanceToImageImageFilter_h
45 template <
class TInput,
class TOutput>
129 template <
class TInputImage,
class TOutputImage>
132 TInputImage, TOutputImage,
133 typename Functor::ReflectanceToImageImageFunctor<typename TInputImage::InternalPixelType, typename TOutputImage::InternalPixelType>>
137 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputImage::ImageDimension);
138 itkStaticConstMacro(OutputImageDimension,
unsigned int, TOutputImage::ImageDimension);
166 typedef typename itk::VariableLengthVector<double>
VectorType;
169 typedef typename InputImageType::SizeType
SizeType;
187 itkGetConstReferenceMacro(SolarIllumination,
VectorType);
190 itkSetMacro(ZenithalSolarAngle,
double);
193 itkGetConstReferenceMacro(ZenithalSolarAngle,
double);
198 double zenithalAngle = 90.0 - elevationAngle;
199 if (this->m_ZenithalSolarAngle != zenithalAngle)
201 this->m_ZenithalSolarAngle = zenithalAngle;
209 return 90.0 - this->m_ZenithalSolarAngle;
215 m_FluxNormalizationCoefficient = coef;
216 m_IsSetFluxNormalizationCoefficient =
true;
224 m_SolarDistance = value;
225 m_IsSetSolarDistance =
true;
230 itkGetConstReferenceMacro(SolarDistance,
double);
233 itkSetMacro(IsSetSolarDistance,
bool);
236 itkGetConstReferenceMacro(IsSetSolarDistance,
bool);
239 itkSetClampMacro(Day,
int, 1, 31);
242 itkGetConstReferenceMacro(Day,
int);
245 itkSetClampMacro(Month,
int, 1, 12);
248 itkGetConstReferenceMacro(Month,
int);
253 : m_ZenithalSolarAngle(120.),
254 m_FluxNormalizationCoefficient(1.),
255 m_IsSetFluxNormalizationCoefficient(false),
258 m_SolarDistance(1.0),
259 m_IsSetSolarDistance(false)
263 m_SolarIllumination.SetSize(0);
275 const auto & metadata = this->GetInput()->GetImageMetadata();
287 if (m_Day == 0 && (!m_IsSetFluxNormalizationCoefficient) && (!m_IsSetSolarDistance)
293 if (m_Month == 0 && (!m_IsSetFluxNormalizationCoefficient) && (!m_IsSetSolarDistance)
318 if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) ||
319 (m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()))
321 itkExceptionMacro(<<
"Alpha, Beta and SolarIllumination parameters should have the same size as the number of bands");
324 this->GetFunctorVector().clear();
325 for (
unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i)
328 double coefTemp = 0.;
330 if (m_IsSetFluxNormalizationCoefficient)
332 coefTemp = std::cos(m_ZenithalSolarAngle *
CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient;
334 else if (m_IsSetSolarDistance)
336 coefTemp = std::cos(m_ZenithalSolarAngle *
CONST_PI_180) / (m_SolarDistance * m_SolarDistance);
338 else if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13)
344 itkExceptionMacro(<<
"Day has to be included between 1 and 31, Month between 1 and 12.");
351 this->GetFunctorVector().push_back(functor);