22 #ifndef otbReflectanceToRadianceImageFilter_h
23 #define otbReflectanceToRadianceImageFilter_h
50 template <
class TInput,
class TOutput>
86 outPixel =
static_cast<TOutput
>(temp);
113 template <
class TInputImage,
class TOutputImage>
116 TInputImage, TOutputImage,
117 typename Functor::ReflectanceToRadianceImageFunctor<typename TInputImage::InternalPixelType, typename TOutputImage::InternalPixelType>>
121 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputImage::ImageDimension);
122 itkStaticConstMacro(OutputImageDimension,
unsigned int, TOutputImage::ImageDimension);
151 typedef typename itk::VariableLengthVector<double>
VectorType;
154 typedef typename InputImageType::SizeType
SizeType;
160 itkGetConstReferenceMacro(SolarIllumination,
VectorType);
163 itkSetMacro(ZenithalSolarAngle,
double);
166 itkGetConstReferenceMacro(ZenithalSolarAngle,
double);
171 double zenithalAngle = 90.0 - elevationAngle;
172 if (this->m_ZenithalSolarAngle != zenithalAngle)
174 this->m_ZenithalSolarAngle = zenithalAngle;
182 return 90.0 - this->m_ZenithalSolarAngle;
186 itkSetClampMacro(Day,
int, 1, 31);
189 itkGetConstReferenceMacro(Day,
int);
192 itkSetClampMacro(Month,
int, 1, 12);
195 itkGetConstReferenceMacro(Month,
int);
200 m_FluxNormalizationCoefficient = coef;
201 m_IsSetFluxNormalizationCoefficient =
true;
206 itkGetConstReferenceMacro(FluxNormalizationCoefficient,
double);
209 itkSetMacro(IsSetFluxNormalizationCoefficient,
bool);
212 itkGetConstReferenceMacro(IsSetFluxNormalizationCoefficient,
bool);
217 m_SolarDistance = value;
218 m_IsSetSolarDistance =
true;
223 itkGetConstReferenceMacro(SolarDistance,
double);
226 itkSetMacro(IsSetSolarDistance,
bool);
229 itkGetConstReferenceMacro(IsSetSolarDistance,
bool);
232 itkSetMacro(UseClamp,
bool);
235 itkGetConstReferenceMacro(UseClamp,
bool);
240 : m_ZenithalSolarAngle(120.0),
241 m_FluxNormalizationCoefficient(1.),
244 m_SolarDistance(1.0),
245 m_IsSetFluxNormalizationCoefficient(false),
246 m_IsSetSolarDistance(false)
248 m_SolarIllumination.SetSize(0);
260 const auto & metadata = this->GetInput()->GetImageMetadata();
262 if (m_Day == 0 && (!m_IsSetFluxNormalizationCoefficient) && (!m_IsSetSolarDistance)
268 if (m_Month == 0 && (!m_IsSetFluxNormalizationCoefficient) && (!m_IsSetSolarDistance)
291 if ((m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()))
293 itkExceptionMacro(<<
"SolarIllumination parameter should have the same size as the number of bands");
296 this->GetFunctorVector().clear();
298 for (
unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i)
301 double coefTemp = 0.;
303 if (m_IsSetFluxNormalizationCoefficient)
305 coefTemp = std::cos(m_ZenithalSolarAngle *
CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient;
307 else if (m_IsSetSolarDistance)
309 coefTemp = std::cos(m_ZenithalSolarAngle *
CONST_PI_180) / (m_SolarDistance * m_SolarDistance);
311 else if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13)
317 itkExceptionMacro(<<
"Day has to be included between 1 and 31, Month between 1 and 12.");
323 this->GetFunctorVector().push_back(functor);