22 #ifndef otbSarRadiometricCalibrationFunction_hxx
23 #define otbSarRadiometricCalibrationFunction_hxx
26 #include "itkNumericTraits.h"
33 template <
class TInputImage,
class TCoordRep>
37 m_RescalingFactor(1.0),
38 m_ApplyAntennaPatternGain(true),
39 m_ApplyIncidenceAngleCorrection(true),
40 m_ApplyRangeSpreadLossCorrection(true),
41 m_ApplyLookupDataCorrection(false),
42 m_ApplyRescalingFactor(false)
63 template <
class TInputImage,
class TCoordRep>
66 Superclass::SetInputImage(ptr);
67 m_Noise->SetInputImage(ptr);
68 m_IncidenceAngle->SetInputImage(ptr);
69 m_AntennaPatternNewGain->SetInputImage(ptr);
70 m_AntennaPatternOldGain->SetInputImage(ptr);
71 m_RangeSpreadLoss->SetInputImage(ptr);
78 template <
class TInputImage,
class TCoordRep>
81 this->Superclass::PrintSelf(os, indent);
88 template <
class TInputImage,
class TCoordRep>
93 if (!this->IsInsideBuffer(index))
95 itkDebugMacro(<<
"ERROR with IsInsideBuffer");
96 return (itk::NumericTraits<OutputType>::max());
101 if (m_ApplyAntennaPatternGain || m_ApplyIncidenceAngleCorrection || m_ApplyRangeSpreadLossCorrection)
102 this->GetInputImage()->TransformIndexToPhysicalPoint(index, point);
113 const std::complex<float> pVal = this->GetInputImage()->GetPixel(index);
114 const RealType digitalNumber = std::sqrt((pVal.real() * pVal.real()) + (pVal.imag() * pVal.imag()));
116 RealType sigma = m_Scale * digitalNumber * digitalNumber;
121 sigma -=
static_cast<RealType>(m_Noise->Evaluate(point));
125 if (m_ApplyIncidenceAngleCorrection)
127 sigma *= std::sin(
static_cast<RealType>(m_IncidenceAngle->Evaluate(point)));
131 if (m_ApplyAntennaPatternGain)
133 sigma *=
static_cast<RealType>(m_AntennaPatternNewGain->Evaluate(point));
134 sigma /=
static_cast<RealType>(m_AntennaPatternOldGain->Evaluate(point));
139 if (m_ApplyRangeSpreadLossCorrection)
141 sigma *=
static_cast<RealType>(m_RangeSpreadLoss->Evaluate(point));
146 if (m_ApplyLookupDataCorrection)
148 if (m_EnableNoise && m_NoiseLut)
150 sigma = std::max(0., sigma - m_NoiseLut->GetValue(index[0], index[1]));
153 RealType lutVal =
static_cast<RealType>(m_Lut->GetValue(index[0], index[1]));
155 sigma /= lutVal * lutVal;
159 if (m_ApplyRescalingFactor)
161 sigma /= m_RescalingFactor;