Commit 407a4a3d authored by Manuel Grizonnet's avatar Manuel Grizonnet

STYLE: clang-format the diff

parent 79c5118d
......@@ -48,14 +48,13 @@ public:
typedef itk::SmartPointer<const Self> ConstPointer;
typedef otb::Functor::SinclairToReciprocalCoherencyMatrixFunctor<ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleVectorImageType::PixelType> FunctorType;
using SRFilterType = otb::SinclairToReciprocalCoherencyMatrixImageFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>;
using SRFilterType = otb::SinclairToReciprocalCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
typedef itk::MeanImageFilter<ComplexDoubleImageType, ComplexDoubleImageType> MeanFilterType;
typedef otb::PerBandVectorImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType, MeanFilterType> PerBandMeanFilterType;
......@@ -83,15 +82,15 @@ private:
// Documentation
SetDocName("SARDecompositions");
SetDocLongDescription("From one-band complex images (HH, HV, VH, VV), returns the selected decomposition.\n \n"
"All the decompositions implemented are intended for the mono-static case (transmitter and receiver are co-located).\n"
"There are two kinds of decomposition: coherent ones and incoherent ones.\n"
"In the coherent case, only the Pauli decomposition is available.\n"
"In the incoherent case, there the decompositions available: Huynen, Barnes, and H-alpha-A.\n"
"User must provide three one-band complex images HH, HV or VH, and VV (mono-static case <=> HV = VH).\n"
"Incoherent decompositions consist in averaging 3x3 complex coherency/covariance matrices; the user must provide the size of the averaging window, thanks to the parameter inco.kernelsize."
);
SetDocLongDescription(
"From one-band complex images (HH, HV, VH, VV), returns the selected decomposition.\n \n"
"All the decompositions implemented are intended for the mono-static case (transmitter and receiver are co-located).\n"
"There are two kinds of decomposition: coherent ones and incoherent ones.\n"
"In the coherent case, only the Pauli decomposition is available.\n"
"In the incoherent case, there the decompositions available: Huynen, Barnes, and H-alpha-A.\n"
"User must provide three one-band complex images HH, HV or VH, and VV (mono-static case <=> HV = VH).\n"
"Incoherent decompositions consist in averaging 3x3 complex coherency/covariance matrices; the user must provide the size of the averaging window, "
"thanks to the parameter inco.kernelsize.");
SetDocLimitations("Some decompositions output real images, while this application outputs complex images for general purpose.\n"
......@@ -159,82 +158,82 @@ private:
void DoExecute() override
{
bool inhv = HasUserValue("inhv");
bool inhv = HasUserValue("inhv");
bool invh = HasUserValue("invh");
if ( (!inhv) && (!invh) )
if ( (!inhv) && (!invh) )
otbAppLogFATAL( << "Parameter inhv or invh not set. Please provide a HV or a VH complex image.");
m_SRFilter = SRFilterType::New();
m_HAFilter = HAFilterType::New();
m_MeanFilter = PerBandMeanFilterType::New();
m_HAFilter = HAFilterType::New();
m_MeanFilter = PerBandMeanFilterType::New();
MeanFilterType::InputSizeType radius;
m_BarnesFilter = BarnesFilterType::New();
m_HuynenFilter = HuynenFilterType::New();
m_PauliFilter = PauliFilterType::New();
m_Concatener = ListConcatenerFilterType::New();
m_ImageList = ImageListType::New();
m_ImageList = ImageListType::New();
switch (GetParameterInt("decomp"))
{
case 0: // H-alpha-A
if (inhv)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
else if (invh)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
if (inhv)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
else if (invh)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
radius.Fill( GetParameterInt("inco.kernelsize") );
m_MeanFilter->GetFilter()->SetRadius(radius);
radius.Fill(GetParameterInt("inco.kernelsize"));
m_MeanFilter->GetFilter()->SetRadius(radius);
m_MeanFilter->SetInput(m_SRFilter->GetOutput());
m_HAFilter->SetInput1(m_MeanFilter->GetOutput());
SetParameterOutputImage("out", m_HAFilter->GetOutput() );
m_MeanFilter->SetInput(m_SRFilter->GetOutput());
m_HAFilter->SetInput1(m_MeanFilter->GetOutput());
SetParameterOutputImage("out", m_HAFilter->GetOutput());
break;
break;
case 1: // Barnes
case 1: // Barnes
if (inhv)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
else if (invh)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
else if (invh)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
radius.Fill( GetParameterInt("inco.kernelsize") );
m_MeanFilter->GetFilter()->SetRadius(radius);
radius.Fill(GetParameterInt("inco.kernelsize"));
m_MeanFilter->GetFilter()->SetRadius(radius);
m_MeanFilter->SetInput(m_SRFilter->GetOutput());
m_BarnesFilter->SetInput1(m_MeanFilter->GetOutput());
SetParameterOutputImage("out", m_BarnesFilter->GetOutput() );
m_MeanFilter->SetInput(m_SRFilter->GetOutput());
m_BarnesFilter->SetInput1(m_MeanFilter->GetOutput());
SetParameterOutputImage("out", m_BarnesFilter->GetOutput());
break;
break;
case 2: // Huynen
case 2: // Huynen
if (inhv)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
else if (invh)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv"));
else if (invh)
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_SRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
radius.Fill( GetParameterInt("inco.kernelsize") );
m_MeanFilter->GetFilter()->SetRadius(radius);
radius.Fill(GetParameterInt("inco.kernelsize"));
m_MeanFilter->GetFilter()->SetRadius(radius);
m_MeanFilter->SetInput(m_SRFilter->GetOutput());
m_HuynenFilter->SetInput1(m_MeanFilter->GetOutput());
SetParameterOutputImage("out", m_HuynenFilter->GetOutput() );
m_MeanFilter->SetInput(m_SRFilter->GetOutput());
m_HuynenFilter->SetInput1(m_MeanFilter->GetOutput());
SetParameterOutputImage("out", m_HuynenFilter->GetOutput());
break;
break;
case 3: // Pauli
case 3: // Pauli
m_ImageList->PushBack(GetParameterComplexDoubleImage("inhh"));
......@@ -245,14 +244,13 @@ private:
m_ImageList->PushBack(GetParameterComplexDoubleImage("invv"));
m_Concatener->SetInput( m_ImageList );
m_PauliFilter->SetInput1(m_Concatener->GetOutput());
m_Concatener->SetInput(m_ImageList);
m_PauliFilter->SetInput1(m_Concatener->GetOutput());
SetParameterOutputImage("out", m_PauliFilter->GetOutput() );
SetParameterOutputImage("out", m_PauliFilter->GetOutput() );
break;
break;
}
}
SRFilterType::Pointer m_SRFilter;
......@@ -263,7 +261,6 @@ private:
PerBandMeanFilterType::Pointer m_MeanFilter;
ListConcatenerFilterType::Pointer m_Concatener;
ImageListType::Pointer m_ImageList;
};
} //end namespace Wrapper
......
......@@ -69,7 +69,7 @@ public:
using CCSRFilterType = SinclairToCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
using MSRFilterType = SinclairToMuellerMatrixImageFilter<ComplexDoubleImageType, DoubleVectorImageType>;
using MRCFilterType = otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType>;
using MRCFilterType = otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType>;
using MPDPFilterType = otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType>;
/** Standard macro */
......@@ -87,38 +87,42 @@ private:
SetDocName("SARPolarMatrixConvert");
SetDocLongDescription(
"This application allows converting classical polarimetric matrices to each other.\n"
"For instance, it is possible to get the coherency matrix from the Sinclar one, or the Mueller matrix from the coherency one.\n"
"The filters used in this application never handle matrices, but images where each band is related to their elements.\n"
"As most of the time SAR polarimetry handles symmetric/hermitian matrices, only the relevant elements are stored, so that the images representing them have a minimal number of bands.\n"
"For instance, the coherency matrix size is 3x3 in the monostatic case, and 4x4 in the bistatic case: it will thus be stored in a 6-band or a 10-band complex image (the diagonal and the upper elements of the matrix).\n"
"\n"
"The Sinclair matrix is a special case: it is always represented as 3 or 4 one-band complex images (for mono or bistatic case).\n"
"The available conversions are listed below:\n"
"\n--- Monostatic case ---\n"
"1 msinclairtocoherency --> Sinclair matrix to coherency matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output: 6 complex channels)\n"
"2 msinclairtocovariance --> Sinclair matrix to covariance matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output: 6 complex channels)\n"
"3 msinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output: 6 complex channels)\n"
"4 mcoherencytomueller --> Coherency matrix to Mueller matrix (input: 6 complex channels | 16 real channels)\n"
"5 mcovariancetocoherencydegree --> Covariance matrix to coherency degree (input: 6 complex channels | 3 complex channels)\n"
"6 mcovariancetocoherency --> Covariance matrix to coherency matrix (input: 6 complex channels | 6 complex channels)\n"
"7 mlinearcovariancetocircularcovariance --> Covariance matrix to circular covariance matrix (input: 6 complex channels | output: 6 complex channels)\n"
"\n--- Bistatic case ---\n"
"8 bsinclairtocoherency --> Sinclair matrix to coherency matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | 10 complex channels)\n"
"9 bsinclairtocovariance --> Sinclair matrix to covariance matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 10 complex channels)\n"
"10 bsinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 10 complex channels)\n"
"\n--- Both cases ---\n"
"11 sinclairtomueller --> Sinclair matrix to Mueller matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 16 real channels)\n"
"12 muellertomcovariance --> Mueller matrix to covariance matrix (input: 16 real channels | output: 6 complex channels)\n"
"13 muellertopoldegandpower --> Mueller matrix to polarization degree and power (input: 16 real channels | output: 4 real channels)"
);
"This application allows converting classical polarimetric matrices to each other.\n"
"For instance, it is possible to get the coherency matrix from the Sinclar one, or the Mueller matrix from the coherency one.\n"
"The filters used in this application never handle matrices, but images where each band is related to their elements.\n"
"As most of the time SAR polarimetry handles symmetric/hermitian matrices, only the relevant elements are stored, so that the images representing them "
"have a minimal number of bands.\n"
"For instance, the coherency matrix size is 3x3 in the monostatic case, and 4x4 in the bistatic case: it will thus be stored in a 6-band or a 10-band "
"complex image (the diagonal and the upper elements of the matrix).\n"
"\n"
"The Sinclair matrix is a special case: it is always represented as 3 or 4 one-band complex images (for mono or bistatic case).\n"
"The available conversions are listed below:\n"
"\n--- Monostatic case ---\n"
"1 msinclairtocoherency --> Sinclair matrix to coherency matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output: 6 complex channels)\n"
"2 msinclairtocovariance --> Sinclair matrix to covariance matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output: 6 complex channels)\n"
"3 msinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input: 3 x 1 complex channel (HH, HV or VH, VV) | output: 6 complex "
"channels)\n"
"4 mcoherencytomueller --> Coherency matrix to Mueller matrix (input: 6 complex channels | 16 real channels)\n"
"5 mcovariancetocoherencydegree --> Covariance matrix to coherency degree (input: 6 complex channels | 3 complex channels)\n"
"6 mcovariancetocoherency --> Covariance matrix to coherency matrix (input: 6 complex channels | 6 complex channels)\n"
"7 mlinearcovariancetocircularcovariance --> Covariance matrix to circular covariance matrix (input: 6 complex channels | output: 6 complex channels)\n"
"\n--- Bistatic case ---\n"
"8 bsinclairtocoherency --> Sinclair matrix to coherency matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | 10 complex channels)\n"
"9 bsinclairtocovariance --> Sinclair matrix to covariance matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 10 complex channels)\n"
"10 bsinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 10 complex "
"channels)\n"
"\n--- Both cases ---\n"
"11 sinclairtomueller --> Sinclair matrix to Mueller matrix (input: 4 x 1 complex channel (HH, HV, VH, VV) | output: 16 real channels)\n"
"12 muellertomcovariance --> Mueller matrix to covariance matrix (input: 16 real channels | output: 6 complex channels)\n"
"13 muellertopoldegandpower --> Mueller matrix to polarization degree and power (input: 16 real channels | output: 4 real channels)"
);
SetDocLimitations("None");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("SARPolarSynth, SARDecompositions");
......@@ -180,23 +184,23 @@ private:
// #4
// ReciprocalCoherencyToReciprocalMuellerImageFilter
AddChoice("conv.mcoherencytomueller","4 Monostatic: Coherency matrix to Mueller matrix");
SetParameterDescription("conv.mcoherencytomueller","4 Monostatic: Coherency matrix to Mueller matrix");
AddChoice("conv.mcoherencytomueller", "4 Monostatic: Coherency matrix to Mueller matrix");
SetParameterDescription("conv.mcoherencytomueller", "4 Monostatic: Coherency matrix to Mueller matrix");
// #5
// ReciprocalCovarianceToCoherencyDegreeImageFilter
AddChoice("conv.mcovariancetocoherencydegree","5 Monostatic: Covariance matrix to coherency degree");
SetParameterDescription("conv.mcovariancetocoherencydegree","5 Monostatic: Covariance matrix to coherency degree ");
AddChoice("conv.mcovariancetocoherencydegree", "5 Monostatic: Covariance matrix to coherency degree");
SetParameterDescription("conv.mcovariancetocoherencydegree", "5 Monostatic: Covariance matrix to coherency degree ");
// #6
// ReciprocalCovarianceToReciprocalCoherencyImageFilter
AddChoice("conv.mcovariancetocoherency","6 Monostatic: Covariance matrix to coherency matrix (complex output)");
SetParameterDescription("conv.mcovariancetocoherency","6 Monostatic: Covariance matrix to coherency matrix (complex output)");
AddChoice("conv.mcovariancetocoherency", "6 Monostatic: Covariance matrix to coherency matrix (complex output)");
SetParameterDescription("conv.mcovariancetocoherency", "6 Monostatic: Covariance matrix to coherency matrix (complex output)");
// #7
// ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
AddChoice("conv.mlinearcovariancetocircularcovariance","7 Monostatic: Covariance matrix to circular covariance matrix (complex output)");
SetParameterDescription("conv.mlinearcovariancetocircularcovariance","7 Monostatic: Covariance matrix to circular covariance matrix (complex output)");
AddChoice("conv.mlinearcovariancetocircularcovariance", "7 Monostatic: Covariance matrix to circular covariance matrix (complex output)");
SetParameterDescription("conv.mlinearcovariancetocircularcovariance", "7 Monostatic: Covariance matrix to circular covariance matrix (complex output)");
// #8
// MuellerToReciprocalCovarianceImageFilter
......
......@@ -40,54 +40,54 @@ namespace otb {
/** Define constants if not define in the "cmath" */
/* Some useful constants. */
constexpr double CONST_E = 2.7182818284590452354; /* e */
constexpr double CONST_LOG2E = 1.4426950408889634074; /* log_2 e */
constexpr double CONST_LOG10E = 0.43429448190325182765; /* log_10 e */
constexpr double CONST_LN2 = 0.69314718055994530942; /* log_e 2 */
constexpr double CONST_LN10 = 2.30258509299404568402; /* log_e 10 */
constexpr double CONST_PI = 3.14159265358979323846; /* pi */
constexpr double CONST_PI_2 = 1.57079632679489661923; /* pi/2 */
constexpr double CONST_PI_4 = 0.78539816339744830962; /* pi/4 */
constexpr double CONST_PI_8 = 0.39269908169872415481; /* pi/8 */
constexpr double CONST_1_PI = 0.31830988618379067154; /* 1/pi */
constexpr double CONST_2_PI = 0.63661977236758134308; /* 2/pi */
constexpr double CONST_2PI = 6.28318530717958647693; /* 2*pi */
constexpr double CONST_PI_180 = 0.01745329251994329577; /* pi/180 */
constexpr double CONST_180_PI = 57.2957795130823208768; /* 180/pi */
constexpr double CONST_LNPI = std::log(CONST_PI); /* ln(pi)*/
constexpr double CONST_SQRTPI = std::sqrt(CONST_PI); /* sqrt(pi)*/
constexpr double CONST_2_SQRTPI = 1.12837916709551257390; /* 2/sqrt(pi) */
constexpr double CONST_SQRT2 = 1.41421356237309504880; /* sqrt(2) */
constexpr double CONST_SQRT1_2 = 0.70710678118654752440; /* 1/sqrt(2) */
constexpr double CONST_SQRT3 = 1.73205080756887729353; /* sqrt(3) */
constexpr double CONST_EULER = 0.57721566490153286060; /* euler constant*/
constexpr double CONST_E = 2.7182818284590452354; /* e */
constexpr double CONST_LOG2E = 1.4426950408889634074; /* log_2 e */
constexpr double CONST_LOG10E = 0.43429448190325182765; /* log_10 e */
constexpr double CONST_LN2 = 0.69314718055994530942; /* log_e 2 */
constexpr double CONST_LN10 = 2.30258509299404568402; /* log_e 10 */
constexpr double CONST_PI = 3.14159265358979323846; /* pi */
constexpr double CONST_PI_2 = 1.57079632679489661923; /* pi/2 */
constexpr double CONST_PI_4 = 0.78539816339744830962; /* pi/4 */
constexpr double CONST_PI_8 = 0.39269908169872415481; /* pi/8 */
constexpr double CONST_1_PI = 0.31830988618379067154; /* 1/pi */
constexpr double CONST_2_PI = 0.63661977236758134308; /* 2/pi */
constexpr double CONST_2PI = 6.28318530717958647693; /* 2*pi */
constexpr double CONST_PI_180 = 0.01745329251994329577; /* pi/180 */
constexpr double CONST_180_PI = 57.2957795130823208768; /* 180/pi */
constexpr double CONST_LNPI = std::log(CONST_PI); /* ln(pi)*/
constexpr double CONST_SQRTPI = std::sqrt(CONST_PI); /* sqrt(pi)*/
constexpr double CONST_2_SQRTPI = 1.12837916709551257390; /* 2/sqrt(pi) */
constexpr double CONST_SQRT2 = 1.41421356237309504880; /* sqrt(2) */
constexpr double CONST_SQRT1_2 = 0.70710678118654752440; /* 1/sqrt(2) */
constexpr double CONST_SQRT3 = 1.73205080756887729353; /* sqrt(3) */
constexpr double CONST_EULER = 0.57721566490153286060; /* euler constant*/
/* The above constants are not adequate for computation using `long double's.
Therefore we provide as an extension constants with similar names as a
GNU extension. Provide enough digits for the 128-bit IEEE quad. */
#ifdef __USE_GNU
constexpr long double CONST_El = 2.7182818284590452353602874713526625L; /* e */
constexpr long double CONST_LOG2El = 1.4426950408889634073599246810018921L; /* log_2 e */
constexpr long double CONST_LOG10El = 0.4342944819032518276511289189166051L; /* log_10 e */
constexpr long double CONST_LN2l = 0.6931471805599453094172321214581766L; /* log_e 2 */
constexpr long double CONST_LN10l = 2.3025850929940456840179914546843642L; /* log_e 10 */
constexpr long double CONST_PIl = 3.1415926535897932384626433832795029L; /* pi */
constexpr long double CONST_PI_2l = 1.5707963267948966192313216916397514L; /* pi/2 */
constexpr long double CONST_PI_4l = 0.7853981633974483096156608458198757L; /* pi/4 */
constexpr long double CONST_PI_8l = 0.3926990816987241548078304229099379L; /* pi/8 */
constexpr long double CONST_2_PIl = 0.6366197723675813430755350534900574L; /* 2/pi */
constexpr long double CONST_2_SQRTPIl = 1.1283791670955125738961589031215452L; /* 2/sqrt(pi) */
constexpr long double CONST_2PIl = 6.2831853071795864769252867665590058L; /* 2*pi */
constexpr long double CONST_PI_180l = 0.0174532925199432957692369076848861L; /* pi/180 */
constexpr long double CONST_180_PIl = 57.295779513082320876798154814105170L; /* 180/pi */
constexpr long double CONST_El = 2.7182818284590452353602874713526625L; /* e */
constexpr long double CONST_LOG2El = 1.4426950408889634073599246810018921L; /* log_2 e */
constexpr long double CONST_LOG10El = 0.4342944819032518276511289189166051L; /* log_10 e */
constexpr long double CONST_LN2l = 0.6931471805599453094172321214581766L; /* log_e 2 */
constexpr long double CONST_LN10l = 2.3025850929940456840179914546843642L; /* log_e 10 */
constexpr long double CONST_PIl = 3.1415926535897932384626433832795029L; /* pi */
constexpr long double CONST_PI_2l = 1.5707963267948966192313216916397514L; /* pi/2 */
constexpr long double CONST_PI_4l = 0.7853981633974483096156608458198757L; /* pi/4 */
constexpr long double CONST_PI_8l = 0.3926990816987241548078304229099379L; /* pi/8 */
constexpr long double CONST_2_PIl = 0.6366197723675813430755350534900574L; /* 2/pi */
constexpr long double CONST_2_SQRTPIl = 1.1283791670955125738961589031215452L; /* 2/sqrt(pi) */
constexpr long double CONST_2PIl = 6.2831853071795864769252867665590058L; /* 2*pi */
constexpr long double CONST_PI_180l = 0.0174532925199432957692369076848861L; /* pi/180 */
constexpr long double CONST_180_PIl = 57.295779513082320876798154814105170L; /* 180/pi */
// Defined but not used?
//const long double CONST_LNPIl = std::log(CONST_PIl); /* ln(pi)*/
//const long double CONST_SQRTPIl = std::sqrt(CONST_PIl); /* sqrt(pi)*/
constexpr long double CONST_SQRT2l = 1.4142135623730950488016887242096981L; /* sqrt(2) */
constexpr long double CONST_SQRT1_2l = 0.7071067811865475244008443621048490L; /* 1/sqrt(2) */
constexpr long double CONST_SQRT3l = 1.7320508075688772935274463415058724L; /* sqrt(3) */
constexpr long double CONST_EULERl = 0.5772156649015328606065120900824024L; /* euler constant*/
constexpr long double CONST_SQRT2l = 1.4142135623730950488016887242096981L; /* sqrt(2) */
constexpr long double CONST_SQRT1_2l = 0.7071067811865475244008443621048490L; /* 1/sqrt(2) */
constexpr long double CONST_SQRT3l = 1.7320508075688772935274463415058724L; /* sqrt(3) */
constexpr long double CONST_EULERl = 0.5772156649015328606065120900824024L; /* euler constant*/
#endif
......
......@@ -87,8 +87,8 @@ public:
typedef itk::Matrix<double, 4, 4> MuellerMatrixType;
typedef itk::Vector<double, 4> StokesVectorType;
inline void operator()( TOutput & result, const TInput & Mueller ) const
{
inline void operator()(TOutput& result, const TInput& Mueller) const
{
double P;
double deg_pol;
double tau;
......@@ -174,32 +174,32 @@ public:
result[3] = l_PolarisationDegreeMax;
}
constexpr size_t OutputSize(...) const
{
// Size of the result
return 4;
constexpr size_t OutputSize(...) const
{
// Size of the result
return 4;
}
private:
static constexpr double m_Epsilon = 1e-6;
static constexpr double m_PI_90 = 2*CONST_PI_180;
static constexpr double m_Epsilon = 1e-6;
static constexpr double m_PI_90 = 2 * CONST_PI_180;
};
} // end namespace functor
/**
* \typedef MuellerToPolarisationDegreeAndPowerImageFilter
* \brief Applies otb::Functor::MuellerToPolarisationDegreeAndPowerFunctor
* \sa otb::Functor::MuellerToPolarisationDegreeAndPowerFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
} // namespace Functor
/**
* \typedef MuellerToPolarisationDegreeAndPowerImageFilter
* \brief Applies otb::Functor::MuellerToPolarisationDegreeAndPowerFunctor
* \sa otb::Functor::MuellerToPolarisationDegreeAndPowerFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using MuellerToPolarisationDegreeAndPowerImageFilter =
FunctorImageFilter<Functor::MuellerToPolarisationDegreeAndPowerFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
FunctorImageFilter<Functor::MuellerToPolarisationDegreeAndPowerFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
......
......@@ -73,7 +73,7 @@ public:
typedef std::complex<double> ComplexType;
typedef typename TOutput::ValueType OutputValueType;
inline void operator()( TOutput & result, const TInput & Mueller ) const
inline void operator()(TOutput& result, const TInput& Mueller) const
{
// Keep the upper diagonal of the matrix
const double M11 = static_cast<double>(Mueller[0]);
......@@ -109,23 +109,23 @@ public:
return 6;
}
};
} // end namespace functor
/**
* \typedef MuellerToReciprocalCovarianceImageFilter
* \brief Applies otb::Functor::MuellerToReciprocalCovarianceFunctor
* \sa otb::Functor::MuellerToReciprocalCovarianceFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
} // namespace Functor
/**
* \typedef MuellerToReciprocalCovarianceImageFilter
* \brief Applies otb::Functor::MuellerToReciprocalCovarianceFunctor
* \sa otb::Functor::MuellerToReciprocalCovarianceFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using MuellerToReciprocalCovarianceImageFilter =
FunctorImageFilter<Functor::MuellerToReciprocalCovarianceFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
FunctorImageFilter<Functor::MuellerToReciprocalCovarianceFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
......
......@@ -23,14 +23,24 @@
namespace otb
{
namespace polarimetry_tags
{
struct hh {};
struct hv {};
struct vh {};
struct vv {};
struct hv_or_vh{};
} // end namespace polarimetry_tags
namespace polarimetry_tags
{
struct hh
{
};
struct hv
{
};
struct vh
{
};
struct vv
{
};
struct hv_or_vh
{
};
} // end namespace polarimetry_tags
} // end namespace otb
#endif
......@@ -52,10 +52,10 @@ public:
typedef std::vector<double> VectorType;
typedef typename TOutput::ValueType OutputValueType;
inline void operator()( TOutput & result, const TInput & Covariance ) const
inline void operator()(TOutput& result, const TInput& Covariance) const
{
VNLMatrixType qi(3,1);
VNLMatrixType qi(3, 1);
VNLMatrixType cov(3, 3);
......@@ -70,31 +70,31 @@ public:
cov[2][2] = ComplexType(Covariance[5]);
qi[0][0]=ComplexType(1.,0.);
qi[1][0]=ComplexType(0.,0.);
qi[2][0]=ComplexType(0.,0.);
ComplexType norm = (qi.conjugate_transpose()*cov*qi)[0][0];
VNLMatrixType ki = cov*qi / std::sqrt(norm);
qi[0][0] = ComplexType(1., 0.);
qi[1][0] = ComplexType(0., 0.);
qi[2][0] = ComplexType(0., 0.);
ComplexType norm = (qi.conjugate_transpose() * cov * qi)[0][0];
VNLMatrixType ki = cov * qi / std::sqrt(norm);
result[0] = static_cast<OutputValueType>(ki[0][0]);
result[1] = static_cast<OutputValueType>(ki[1][0]);
result[2] = static_cast<OutputValueType>(ki[2][0]);
qi[0][0]=ComplexType(0.,0.);
qi[1][0]=ComplexType(1./std::sqrt(2.),0.);
qi[2][0]=ComplexType(0.,1./std::sqrt(2.));
norm = (qi.conjugate_transpose()*cov*qi)[0][0];
ki = cov*qi / std::sqrt(norm);
qi[0][0] = ComplexType(0., 0.);
qi[1][0] = ComplexType(1. / std::sqrt(2.), 0.);
qi[2][0] = ComplexType(0., 1. / std::sqrt(2.));
norm = (qi.conjugate_transpose() * cov * qi)[0][0];
ki = cov * qi / std::sqrt(norm);
result[3] = static_cast<OutputValueType>(ki[0][0]);
result[4] = static_cast<OutputValueType>(ki[1][0]);
result[5] = static_cast<OutputValueType>(ki[2][0]);
qi[0][0]=ComplexType(0.,0.);
qi[1][0]=ComplexType(0.,1./std::sqrt(2.));
qi[2][0]=ComplexType(1./std::sqrt(2.),0.);
norm = (qi.conjugate_transpose()*cov*qi)[0][0];
ki = cov*qi / std::sqrt(norm);
qi[1][0] = ComplexType(0., 1. / std::sqrt(2.));
qi[2][0] = ComplexType(1. / std::sqrt(2.), 0.);
norm = (qi.conjugate_transpose() * cov * qi)[0][0];
ki = cov * qi / std::sqrt(norm);
result[6] = static_cast<OutputValueType>(ki[0][0]);
result[7] = static_cast<OutputValueType>(ki[1][0]);
result[8] = static_cast<OutputValueType>(ki[2][0]);
......@@ -105,26 +105,27 @@ public:
// Size of the result
return 9;
}
private:
static constexpr double m_Epsilon = 1e-6;
static constexpr double m_Epsilon = 1e-6;
};
} // end namespace functor
/**
* \typedef ReciprocalBarnesDecompImageFilter
* \brief Applies otb::Functor::ReciprocalBarnesDecompFunctor
* \sa otb::Functor::ReciprocalBarnesDecompFunctor
*
* Set inputs with:
* \code