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;
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);
Subtract beta to the Input and multiply by alpha.
void SetBeta(double beta)
void SetAlpha(double alpha)
Call the ReflectanceToRadianceFunctor over the input and the RadianceToImageFunctor to this result.
double GetSolarIllumination()
Functor::ReflectanceToRadianceImageFunctor< TInput, TOutput > ReflecToLumFunctorType
TOutput operator()(const TInput &inPixel) const
ReflecToLumFunctorType m_ReflecToLumFunctor
void SetBeta(double beta)
double GetIlluminationCorrectionCoefficient()
Functor::RadianceToImageImageFunctor< TInput, TOutput > LumToImFunctorType
LumToImFunctorType m_LumToImFunctor
void SetAlpha(double alpha)
void SetSolarIllumination(double solarIllumination)
virtual ~ReflectanceToImageImageFunctor()
ReflectanceToImageImageFunctor()
void SetIlluminationCorrectionCoefficient(double coef)
Compute radiance from the reflectance value.
double GetSolarIllumination()
void SetIlluminationCorrectionCoefficient(double coef)
void SetSolarIllumination(double solarIllumination)
double GetIlluminationCorrectionCoefficient()
Convert a reflectance into a raw value value.
ReflectanceToImageImageFilter()
InputImageType::PixelType InputPixelType
OutputImageType::PixelType OutputPixelType
itk::SmartPointer< const Self > ConstPointer
TInputImage InputImageType
void SetFluxNormalizationCoefficient(double coef)
ReflectanceToImageImageFilter Self
InputImageType::SizeType SizeType
itk::SmartPointer< Self > Pointer
double m_FluxNormalizationCoefficient
void SetSolarDistance(double value)
~ReflectanceToImageImageFilter() override
InputImageType::InternalPixelType InputInternalPixelType
OutputImageType::RegionType OutputImageRegionType
void BeforeThreadedGenerateData(void) override
TOutputImage OutputImageType
InputImageType::RegionType InputImageRegionType
virtual void SetElevationSolarAngle(double elevationAngle)
VectorType m_SolarIllumination
bool m_IsSetSolarDistance
bool m_IsSetFluxNormalizationCoefficient
itk::VariableLengthVector< double > VectorType
OutputImageType::InternalPixelType OutputInternalPixelType
Functor::ReflectanceToImageImageFunctor< typename InputImageType::InternalPixelType, typename OutputImageType::InternalPixelType > FunctorType
double m_ZenithalSolarAngle
UnaryImageFunctorWithVectorImageFilter< InputImageType, OutputImageType, FunctorType > Superclass
virtual double GetElevationSolarAngle() const
Applies a functor to a VectorImage.
static double GetVarSol(const int day, const int month)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
constexpr double CONST_PI_180
#define otbMsgDevMacro(x)