21 #ifndef otbTerraSarBrightnessFunctor_hxx
22 #define otbTerraSarBrightnessFunctor_hxx
26 #include "itkNumericTraits.h"
33 template <
class TInput,
class TOutput>
36 m_CalibrationFactor = itk::NumericTraits<double>::Zero;
37 m_ResultsInDecibels =
false;
38 m_DefaultValue = 0.00001;
41 template <
class TInput,
class TOutput>
47 double squareInPix = std::pow(
static_cast<double>(inPix), 2.);
50 double beta = m_CalibrationFactor * squareInPix;
53 beta = m_DefaultValue;
56 if (m_ResultsInDecibels)
58 beta = 10 * std::log10(beta);
61 return static_cast<TOutput
>(beta);
64 template <
class TInput,
class TOutput>
68 double modulus = std::sqrt(inPix.real() * inPix.real() + inPix.imag() * inPix.imag());
69 double phase = std::atan2(inPix.imag(), inPix.real());
72 double beta = this->operator()(modulus);
75 std::complex<TOutput> out(std::polar(beta, phase));