22 #ifndef otbSarRadiometricCalibrationToImageFilter_hxx
23 #define otbSarRadiometricCalibrationToImageFilter_hxx
28 #include <boost/any.hpp>
36 template <
class TInputImage,
class TOutputImage>
41 template <
class TInputImage,
class TOutputImage>
44 Superclass::GenerateOutputInformation();
49 if (inputPtr.IsNull())
51 itkExceptionMacro(<<
"At least one input is missing."
52 <<
" Input is missing :" << inputPtr.GetPointer())
56 if (outputPtr.IsNull())
58 itkExceptionMacro(<<
"At least one output is missing."
59 <<
" Output is missing :" << outputPtr.GetPointer())
63 template <
class TInputImage,
class TOutputImage>
67 Superclass::BeforeThreadedGenerateData();
70 auto imd = this->GetInput()->GetImageMetadata();
73 std::unique_ptr<SARCalib> sarCalibPtr;
76 sarCalibPtr = std::make_unique<SARCalib>(boost::any_cast<SARCalib>(imd[
MDGeom::SARCalib]));
80 sarCalibPtr = std::make_unique<SARCalib>(boost::any_cast<SARCalib>(imd.Bands[0][
MDGeom::SARCalib]));
83 throw std::runtime_error(
"otbSarRadiometricCalibrationToImageFilter was not able to fetch the SARCalib metadata.");
104 function->SetApplyAntennaPatternGain(!
apply);
105 function->SetApplyIncidenceAngleCorrection(!
apply);
106 function->SetApplyRangeSpreadLossCorrection(!
apply);
107 function->SetApplyRescalingFactor(!
apply);
108 function->SetApplyLookupDataCorrection(
apply);
112 else if ((imd.Bands.size() > 0) && (imd.Bands[0].Has(
MDNum::CalScale)))
116 if (function->GetEnableNoise())
128 noise =
function->GetNoise();
131 noise->EvaluateParametricCoefficient();
136 if (function->GetApplyAntennaPatternGain())
139 antennaPatternNewGain =
function->GetAntennaPatternNewGain();
142 antennaPatternNewGain->EvaluateParametricCoefficient();
145 antennaPatternOldGain =
function->GetAntennaPatternOldGain();
148 antennaPatternOldGain->EvaluateParametricCoefficient();
152 if (function->GetApplyIncidenceAngleCorrection())
155 incidenceAngle =
function->GetIncidenceAngle();
158 incidenceAngle->EvaluateParametricCoefficient();
162 if (function->GetApplyRangeSpreadLossCorrection())
165 rangeSpreadLoss =
function->GetRangeSpreadLoss();
168 rangeSpreadLoss->EvaluateParametricCoefficient();
180 if (function->GetApplyLookupDataCorrection())
186 if (function->GetApplyRescalingFactor())