diff --git a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx index 84e9929600baae75ae94e9e5223fa96fc8441757..8fe3af9978c896039a0bb3dbd908283bfab64a6e 100644 --- a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx +++ b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx @@ -21,12 +21,6 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" - -#include "otbReciprocalHAlphaImageFilter.h" -#include "otbReciprocalBarnesDecompImageFilter.h" -#include "otbReciprocalHuynenDecompImageFilter.h" -#include "otbReciprocalPauliDecompImageFilter.h" - #include "otbSinclairImageFilters.h" #include "otbPerBandVectorImageFilter.h" @@ -194,7 +188,7 @@ private: m_MeanFilter->GetFilter()->SetRadius(radius); m_MeanFilter->SetInput(m_SRFilter->GetOutput()); - m_HAFilter->SetInput(m_MeanFilter->GetOutput()); + m_HAFilter->SetInput1(m_MeanFilter->GetOutput()); SetParameterOutputImage("out", m_HAFilter->GetOutput() ); break; @@ -213,7 +207,7 @@ private: m_MeanFilter->GetFilter()->SetRadius(radius); m_MeanFilter->SetInput(m_SRFilter->GetOutput()); - m_BarnesFilter->SetInput(m_MeanFilter->GetOutput()); + m_BarnesFilter->SetInput1(m_MeanFilter->GetOutput()); SetParameterOutputImage("out", m_BarnesFilter->GetOutput() ); break; @@ -232,7 +226,7 @@ private: m_MeanFilter->GetFilter()->SetRadius(radius); m_MeanFilter->SetInput(m_SRFilter->GetOutput()); - m_HuynenFilter->SetInput(m_MeanFilter->GetOutput()); + m_HuynenFilter->SetInput1(m_MeanFilter->GetOutput()); SetParameterOutputImage("out", m_HuynenFilter->GetOutput() ); break; @@ -249,7 +243,7 @@ private: m_ImageList->PushBack(GetParameterComplexDoubleImage("invv")); m_Concatener->SetInput( m_ImageList ); - m_PauliFilter->SetInput(m_Concatener->GetOutput()); + m_PauliFilter->SetInput1(m_Concatener->GetOutput()); SetParameterOutputImage("out", m_PauliFilter->GetOutput() ); diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx index c996bd558eb325a6afd004fc796278644c02997b..74339a90eb4208172b341e8e329be3f2c8efca3b 100644 --- a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx +++ b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx @@ -21,7 +21,7 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" -//monostatic case +// monostatic case //#include "otbSinclairReciprocalImageFilter.h" //#include "otbSinclairToReciprocalCoherencyMatrixFunctor.h" //#include "otbSinclairToReciprocalCovarianceMatrixFunctor.h" @@ -32,14 +32,13 @@ #include "otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h" #include "otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h" -//bistatic case +// bistatic case #include "otbSinclairImageFilters.h" #include "otbMuellerToReciprocalCovarianceImageFilter.h" #include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h" - namespace otb { namespace Wrapper @@ -49,38 +48,37 @@ class SARPolarMatrixConvert : public Application { public: /** Standard class typedefs. */ - typedef SARPolarMatrixConvert Self; - typedef Application Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + typedef SARPolarMatrixConvert Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; - //Monostatic case - using RCohSRFilterType = SinclairToReciprocalCoherencyMatrixFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>; - using RCovSRFilterType = SinclairToReciprocalCovarianceMatrixFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>; - using RCCSRFilterType = SinclairToReciprocalCircularCovarianceMatrixFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>; + // Monostatic case + using RCohSRFilterType = SinclairToReciprocalCoherencyMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>; + using RCovSRFilterType = SinclairToReciprocalCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>; + using RCCSRFilterType = SinclairToReciprocalCircularCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>; typedef otb::ReciprocalCoherencyToReciprocalMuellerImageFilter<ComplexDoubleVectorImageType, DoubleVectorImageType> RCRMFilterType; - typedef otb::ReciprocalCovarianceToCoherencyDegreeImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RCCDFilterType; + typedef otb::ReciprocalCovarianceToCoherencyDegreeImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RCCDFilterType; - typedef otb::ReciprocalCovarianceToReciprocalCoherencyImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RCRCFilterType; + typedef otb::ReciprocalCovarianceToReciprocalCoherencyImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RCRCFilterType; - typedef otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RLCRCCFilterType; + typedef otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RLCRCCFilterType; - //Bistatic case + // Bistatic case using CohSRFilterType = SinclairToCoherencyMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>; using CovSRFilterType = SinclairToCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>; - using CCSRFilterType = SinclairToCircularCovarianceMatrixFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>; - using MSRFilterType = SinclairToMuellerMatrixFilter<ComplexDoubleImageType,DoubleVectorImageType>; - + using CCSRFilterType = SinclairToCircularCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>; + using MSRFilterType = SinclairToMuellerMatrixFilter<ComplexDoubleImageType, DoubleVectorImageType>; - typedef otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType> MRCFilterType; - typedef otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType> MPDPFilterType; + typedef otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType> MRCFilterType; + typedef otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType> MPDPFilterType; /** Standard macro */ @@ -98,38 +96,43 @@ 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" + "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" + "\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" + "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" + "\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" + "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" + "\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)" + "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"); @@ -162,89 +165,88 @@ private: SetParameterDescription("invv", "Input : one-band complex image (VV)"); MandatoryOff("invv"); - AddParameter(ParameterType_OutputImage, "outc", "Output Complex Image"); + AddParameter(ParameterType_OutputImage, "outc", "Output Complex Image"); SetParameterDescription("outc", "Output Complex image."); MandatoryOff("outc"); - AddParameter(ParameterType_OutputImage, "outf", "Output Real Image"); + AddParameter(ParameterType_OutputImage, "outf", "Output Real Image"); SetParameterDescription("outf", "Output Real image."); MandatoryOff("outf"); - AddParameter(ParameterType_Choice, "conv", "Conversion"); - //Monostatic case + // Monostatic case // #1 // SinclairToReciprocalCoherency - AddChoice("conv.msinclairtocoherency","1 Monostatic : Sinclair matrix to coherency matrix (complex output)"); - SetParameterDescription("conv.msinclairtocoherency","1 Monostatic :Sinclair matrix to coherency matrix (complex output)"); + AddChoice("conv.msinclairtocoherency", "1 Monostatic : Sinclair matrix to coherency matrix (complex output)"); + SetParameterDescription("conv.msinclairtocoherency", "1 Monostatic :Sinclair matrix to coherency matrix (complex output)"); // #2 // SinclairToReciprocalCovariance - AddChoice("conv.msinclairtocovariance","2 Monostatic : Sinclair matrix to covariance matrix (complex output)"); - SetParameterDescription("conv.msinclairtocovariance","2 Monostatic : Sinclair matrix to covariance matrix (complex output)"); + AddChoice("conv.msinclairtocovariance", "2 Monostatic : Sinclair matrix to covariance matrix (complex output)"); + SetParameterDescription("conv.msinclairtocovariance", "2 Monostatic : Sinclair matrix to covariance matrix (complex output)"); // #3 // SinclairToReciprocalCircularCovariance - AddChoice("conv.msinclairtocircovariance","3 Monostatic : Sinclair matrix to circular covariance matrix (complex output)"); - SetParameterDescription("conv.msinclairtocircovariance","3 Monostatic : Sinclair matrix to circular covariance matrix (complex output)"); + AddChoice("conv.msinclairtocircovariance", "3 Monostatic : Sinclair matrix to circular covariance matrix (complex output)"); + SetParameterDescription("conv.msinclairtocircovariance", "3 Monostatic : Sinclair matrix to circular covariance matrix (complex output)"); // #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 - AddChoice("conv.muellertomcovariance","8 Bi/mono : Mueller matrix to monostatic covariance matrix"); - SetParameterDescription("conv.muellertomcovariance","8 Bi/mono : Mueller matrix to monostatic covariance matrix"); + AddChoice("conv.muellertomcovariance", "8 Bi/mono : Mueller matrix to monostatic covariance matrix"); + SetParameterDescription("conv.muellertomcovariance", "8 Bi/mono : Mueller matrix to monostatic covariance matrix"); - //Bistatic case + // Bistatic case // #9 // SinclairToCoherency - AddChoice("conv.bsinclairtocoherency","9 Bistatic : Sinclair matrix to coherency matrix (complex output)"); - SetParameterDescription("conv.bsinclairtocoherency","9 Bistatic : Sinclair matrix to coherency matrix (complex output)"); + AddChoice("conv.bsinclairtocoherency", "9 Bistatic : Sinclair matrix to coherency matrix (complex output)"); + SetParameterDescription("conv.bsinclairtocoherency", "9 Bistatic : Sinclair matrix to coherency matrix (complex output)"); // #10 // SinclairToCovariance - AddChoice("conv.bsinclairtocovariance","10 Bistatic : Sinclair matrix to covariance matrix (complex output)"); - SetParameterDescription("conv.bsinclairtocovariance","10 Bistatic : Sinclair matrix to covariance matrix (complex output)"); + AddChoice("conv.bsinclairtocovariance", "10 Bistatic : Sinclair matrix to covariance matrix (complex output)"); + SetParameterDescription("conv.bsinclairtocovariance", "10 Bistatic : Sinclair matrix to covariance matrix (complex output)"); // #11 // SinclairToCircularCovariance - AddChoice("conv.bsinclairtocircovariance","11 Bistatic : Sinclair matrix to circular covariance matrix (complex output)"); - SetParameterDescription("conv.bsinclairtocircovariance","11 Bistatic : Sinclair matrix to circular covariance matrix (complex output)"); + AddChoice("conv.bsinclairtocircovariance", "11 Bistatic : Sinclair matrix to circular covariance matrix (complex output)"); + SetParameterDescription("conv.bsinclairtocircovariance", "11 Bistatic : Sinclair matrix to circular covariance matrix (complex output)"); - //Both case + // Both case // #12 // SinclairToMueller - AddChoice("conv.sinclairtomueller","12 Bi/mono : Sinclair matrix to Mueller matrix"); - SetParameterDescription("conv.sinclairtomueller","12 Bi/mono : Sinclair matrix to Mueller matrix"); + AddChoice("conv.sinclairtomueller", "12 Bi/mono : Sinclair matrix to Mueller matrix"); + SetParameterDescription("conv.sinclairtomueller", "12 Bi/mono : Sinclair matrix to Mueller matrix"); // #13 // MuellerToPolarisationDegreeAndPowerImageFilter - AddChoice("conv.muellertopoldegandpower","13 Bi/mono : Mueller matrix to polarisation degree and power"); - SetParameterDescription("conv.muellertopoldegandpower","13 Bi/mono : Mueller matrix to polarisation degree and power"); + AddChoice("conv.muellertopoldegandpower", "13 Bi/mono : Mueller matrix to polarisation degree and power"); + SetParameterDescription("conv.muellertopoldegandpower", "13 Bi/mono : Mueller matrix to polarisation degree and power"); AddRAMParameter(); @@ -253,9 +255,9 @@ private: // Doc example parameter settings SetDocExampleParameterValue("inhh", "HH.tif"); - SetDocExampleParameterValue("invh", "VH.tif"); - SetDocExampleParameterValue("invv", "VV.tif"); - SetDocExampleParameterValue("conv", "msinclairtocoherency"); + SetDocExampleParameterValue("invh", "VH.tif"); + SetDocExampleParameterValue("invv", "VV.tif"); + SetDocExampleParameterValue("conv", "msinclairtocoherency"); SetDocExampleParameterValue("outc", "mcoherency.tif"); SetOfficialDocLink(); @@ -266,325 +268,314 @@ private: int convType = GetParameterInt("conv"); - if ( (convType>=0) && (convType<=2)) //msinclairtocoherency msinclairtocovariance msinclairtocircovariance - { - GetParameterByKey("inc")->SetActive(false); - GetParameterByKey("inf")->SetActive(false); - GetParameterByKey("inhh")->SetActive(true); - GetParameterByKey("inhv")->SetActive(true); - GetParameterByKey("invh")->SetActive(true); - GetParameterByKey("invv")->SetActive(true); - GetParameterByKey("outc")->SetActive(true); - GetParameterByKey("outf")->SetActive(false); - } - else if ( (convType>=3) && (convType<=6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance - { - GetParameterByKey("inc")->SetActive(true); - GetParameterByKey("inf")->SetActive(false); - GetParameterByKey("inhh")->SetActive(false); - GetParameterByKey("inhv")->SetActive(false); - GetParameterByKey("invh")->SetActive(false); - GetParameterByKey("invv")->SetActive(false); - - if (convType == 3) - { - GetParameterByKey("outc")->SetActive(false); - GetParameterByKey("outf")->SetActive(true); - } - else - { - GetParameterByKey("outc")->SetActive(true); - GetParameterByKey("outf")->SetActive(false); - } - } - else if ( convType==7) // muellertomcovariance - { - GetParameterByKey("inc")->SetActive(false); - GetParameterByKey("inf")->SetActive(true); - GetParameterByKey("inhh")->SetActive(false); - GetParameterByKey("inhv")->SetActive(false); - GetParameterByKey("invh")->SetActive(false); - GetParameterByKey("invv")->SetActive(false); - GetParameterByKey("outc")->SetActive(true); - GetParameterByKey("outf")->SetActive(false); - } - else if ( (convType>=8) && (convType<=11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller - { - GetParameterByKey("inc")->SetActive(false); - GetParameterByKey("inf")->SetActive(false); - GetParameterByKey("inhh")->SetActive(true); - GetParameterByKey("inhv")->SetActive(true); - GetParameterByKey("invh")->SetActive(true); - GetParameterByKey("invv")->SetActive(true); - - if (convType == 11) - { - GetParameterByKey("outc")->SetActive(false); - GetParameterByKey("outf")->SetActive(true); - } - else - { - GetParameterByKey("outc")->SetActive(true); - GetParameterByKey("outf")->SetActive(false); - } - - } - else if ( convType==12 ) // muellertopoldegandpower - { - GetParameterByKey("inc")->SetActive(false); - GetParameterByKey("inf")->SetActive(true); - GetParameterByKey("inhh")->SetActive(false); - GetParameterByKey("inhv")->SetActive(false); - GetParameterByKey("invh")->SetActive(false); - GetParameterByKey("invv")->SetActive(false); - GetParameterByKey("outc")->SetActive(false); - GetParameterByKey("outf")->SetActive(true); - } - - - + if ((convType >= 0) && (convType <= 2)) // msinclairtocoherency msinclairtocovariance msinclairtocircovariance + { + GetParameterByKey("inc")->SetActive(false); + GetParameterByKey("inf")->SetActive(false); + GetParameterByKey("inhh")->SetActive(true); + GetParameterByKey("inhv")->SetActive(true); + GetParameterByKey("invh")->SetActive(true); + GetParameterByKey("invv")->SetActive(true); + GetParameterByKey("outc")->SetActive(true); + GetParameterByKey("outf")->SetActive(false); + } + else if ((convType >= 3) && + (convType <= 6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance + { + GetParameterByKey("inc")->SetActive(true); + GetParameterByKey("inf")->SetActive(false); + GetParameterByKey("inhh")->SetActive(false); + GetParameterByKey("inhv")->SetActive(false); + GetParameterByKey("invh")->SetActive(false); + GetParameterByKey("invv")->SetActive(false); + + if (convType == 3) + { + GetParameterByKey("outc")->SetActive(false); + GetParameterByKey("outf")->SetActive(true); + } + else + { + GetParameterByKey("outc")->SetActive(true); + GetParameterByKey("outf")->SetActive(false); + } + } + else if (convType == 7) // muellertomcovariance + { + GetParameterByKey("inc")->SetActive(false); + GetParameterByKey("inf")->SetActive(true); + GetParameterByKey("inhh")->SetActive(false); + GetParameterByKey("inhv")->SetActive(false); + GetParameterByKey("invh")->SetActive(false); + GetParameterByKey("invv")->SetActive(false); + GetParameterByKey("outc")->SetActive(true); + GetParameterByKey("outf")->SetActive(false); + } + else if ((convType >= 8) && (convType <= 11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller + { + GetParameterByKey("inc")->SetActive(false); + GetParameterByKey("inf")->SetActive(false); + GetParameterByKey("inhh")->SetActive(true); + GetParameterByKey("inhv")->SetActive(true); + GetParameterByKey("invh")->SetActive(true); + GetParameterByKey("invv")->SetActive(true); + + if (convType == 11) + { + GetParameterByKey("outc")->SetActive(false); + GetParameterByKey("outf")->SetActive(true); + } + else + { + GetParameterByKey("outc")->SetActive(true); + GetParameterByKey("outf")->SetActive(false); + } + } + else if (convType == 12) // muellertopoldegandpower + { + GetParameterByKey("inc")->SetActive(false); + GetParameterByKey("inf")->SetActive(true); + GetParameterByKey("inhh")->SetActive(false); + GetParameterByKey("inhv")->SetActive(false); + GetParameterByKey("invh")->SetActive(false); + GetParameterByKey("invv")->SetActive(false); + GetParameterByKey("outc")->SetActive(false); + GetParameterByKey("outf")->SetActive(true); + } } void DoExecute() override { //**************************************** - //* Check inputs and outputs consistency * - //**************************************** - - bool inc = HasUserValue("inc"); - bool inf = HasUserValue("inf"); - bool inhh = HasUserValue("inhh"); - bool inhv = HasUserValue("inhv"); - bool invh = HasUserValue("invh"); - bool invv = HasUserValue("invv"); - bool outc = HasUserValue("outc"); - bool outf = HasUserValue("outf"); - - int convType = GetParameterInt("conv"); - - - if ( (!outc) && (!outf) ) - otbAppLogFATAL( << "No output image provided; please, set the parameter 'outc' or 'outf'."); - - - if ( (convType>=0) && (convType<=2)) //msinclairtocoherency msinclairtocovariance msinclairtocircovariance - { - if ( (!inhv) && (!invh) ) - otbAppLogFATAL( << "Parameter 'inhv' or 'invh' not set."); - if ( !inhh ) - otbAppLogFATAL( << "Parameter 'inhh' not set."); - if ( !invv ) - otbAppLogFATAL( << "Parameter 'invv' not set."); - - } - - else if ( (convType>=3) && (convType<=6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance - { - if ( !inc ) - otbAppLogFATAL( << "Parameter 'inc' not set."); - } - else if ( (convType>=8) && (convType<=11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller - { - if ( (!inhh) || (!inhv) || (!invh) || (!invv) ) - otbAppLogFATAL( << "Please, ensure that HH, HV, VH and VV complex images have been provided (parameters inhh, inhv, invh, invv)."); - } - else if ( (convType==7) || (convType==12) ) // muellertomcovariance muellertopoldegandpower - { - if ( !inf ) - otbAppLogFATAL( << "Parameter 'inf' not set."); - } - - - switch (GetParameterInt("conv")) - { + //* Check inputs and outputs consistency * + //**************************************** - //*************************************** - //* MONOSTATIC * - //*************************************** + bool inc = HasUserValue("inc"); + bool inf = HasUserValue("inf"); + bool inhh = HasUserValue("inhh"); + bool inhv = HasUserValue("inhv"); + bool invh = HasUserValue("invh"); + bool invv = HasUserValue("invv"); + bool outc = HasUserValue("outc"); + bool outf = HasUserValue("outf"); - case 0: // SinclairToReciprocalCoherency - m_RCohSRFilter = RCohSRFilterType::New(); + int convType = GetParameterInt("conv"); - if (inhv) - m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv")); - else if (invh) - m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh")); - m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + if ((!outc) && (!outf)) + otbAppLogFATAL(<< "No output image provided; please, set the parameter 'outc' or 'outf'."); - SetParameterOutputImage("outc", m_RCohSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels - break; + if ((convType >= 0) && (convType <= 2)) // msinclairtocoherency msinclairtocovariance msinclairtocircovariance + { + if ((!inhv) && (!invh)) + otbAppLogFATAL(<< "Parameter 'inhv' or 'invh' not set."); + if (!inhh) + otbAppLogFATAL(<< "Parameter 'inhh' not set."); + if (!invv) + otbAppLogFATAL(<< "Parameter 'invv' not set."); + } + else if ((convType >= 3) && + (convType <= 6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance + { + if (!inc) + otbAppLogFATAL(<< "Parameter 'inc' not set."); + } + else if ((convType >= 8) && (convType <= 11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller + { + if ((!inhh) || (!inhv) || (!invh) || (!invv)) + otbAppLogFATAL(<< "Please, ensure that HH, HV, VH and VV complex images have been provided (parameters inhh, inhv, invh, invv)."); + } + else if ((convType == 7) || (convType == 12)) // muellertomcovariance muellertopoldegandpower + { + if (!inf) + otbAppLogFATAL(<< "Parameter 'inf' not set."); + } - case 1: // SinclairToReciprocalCovariance - m_RCovSRFilter = RCovSRFilterType::New(); + switch (GetParameterInt("conv")) + { - if (inhv) - m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv")); - else if (invh) - m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh")); + //*************************************** + //* MONOSTATIC * + //*************************************** - m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + case 0: // SinclairToReciprocalCoherency + m_RCohSRFilter = RCohSRFilterType::New(); - SetParameterOutputImage("outc", m_RCovSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels + if (inhv) + m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv")); + else if (invh) + m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh")); - break; + m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_RCohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + SetParameterOutputImage("outc", m_RCohSRFilter->GetOutput()); // input : 3 x 1 complex channel | output : 6 complex channels + break; - case 2: // SinclairToReciprocalCircularCovariance - m_RCCSRFilter = RCCSRFilterType::New(); + case 1: // SinclairToReciprocalCovariance - if (inhv) - m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv")); - else if (invh) - m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh")); + m_RCovSRFilter = RCovSRFilterType::New(); - m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + if (inhv) + m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv")); + else if (invh) + m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh")); - SetParameterOutputImage("outc", m_RCCSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels + m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_RCovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); - break; + SetParameterOutputImage("outc", m_RCovSRFilter->GetOutput()); // input : 3 x 1 complex channel | output : 6 complex channels + break; - case 3: // ReciprocalCoherencyToReciprocalMuellerImageFilter - m_RCRMFilter = RCRMFilterType::New(); - m_RCRMFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); + case 2: // SinclairToReciprocalCircularCovariance - SetParameterOutputImage("outf", m_RCRMFilter->GetOutput() ); // input : 6 complex channels | 16 real channels + m_RCCSRFilter = RCCSRFilterType::New(); - break; + if (inhv) + m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("inhv")); + else if (invh) + m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(GetParameterComplexDoubleImage("invh")); + m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_RCCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + SetParameterOutputImage("outc", m_RCCSRFilter->GetOutput()); // input : 3 x 1 complex channel | output : 6 complex channels - case 4: // ReciprocalCovarianceToCoherencyDegreeImageFilter + break; - m_RCCDFilter = RCCDFilterType::New(); - m_RCCDFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - SetParameterOutputImage("outc", m_RCCDFilter->GetOutput() ); // input : 6 complex channels | 3 complex channels + case 3: // ReciprocalCoherencyToReciprocalMuellerImageFilter - break; + m_RCRMFilter = RCRMFilterType::New(); + m_RCRMFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); + SetParameterOutputImage("outf", m_RCRMFilter->GetOutput()); // input : 6 complex channels | 16 real channels - case 5: // ReciprocalCovarianceToReciprocalCoherencyImageFilter + break; - m_RCRCFilter = RCRCFilterType::New(); - m_RCRCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - SetParameterOutputImage("outc", m_RCRCFilter->GetOutput() ); // input : 6 complex channels | 6 complex channels + case 4: // ReciprocalCovarianceToCoherencyDegreeImageFilter - break; + m_RCCDFilter = RCCDFilterType::New(); + m_RCCDFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); + SetParameterOutputImage("outc", m_RCCDFilter->GetOutput()); // input : 6 complex channels | 3 complex channels + break; - case 6: // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter - m_RLCRCCFilter = RLCRCCFilterType::New(); - m_RLCRCCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); + case 5: // ReciprocalCovarianceToReciprocalCoherencyImageFilter - SetParameterOutputImage("outc", m_RLCRCCFilter->GetOutput() ); // input : 6 complex channels | output : 6 complex channels + m_RCRCFilter = RCRCFilterType::New(); + m_RCRCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - break; + SetParameterOutputImage("outc", m_RCRCFilter->GetOutput()); // input : 6 complex channels | 6 complex channels + break; - case 7: // MuellerToReciprocalCovarianceImageFilter - m_MRCFilter = MRCFilterType::New(); + case 6: // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter - m_MRCFilter->SetInput(GetParameterDoubleVectorImage("inf")); + m_RLCRCCFilter = RLCRCCFilterType::New(); + m_RLCRCCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - SetParameterOutputImage("outc", m_MRCFilter->GetOutput() ); // input : 16 real channels | output : 6 complex channels + SetParameterOutputImage("outc", m_RLCRCCFilter->GetOutput()); // input : 6 complex channels | output : 6 complex channels - break; + break; - //*************************************** - //* BISTATIC * - //*************************************** + case 7: // MuellerToReciprocalCovarianceImageFilter - case 8: // SinclairToCoherency + m_MRCFilter = MRCFilterType::New(); - m_CohSRFilter = CohSRFilterType::New(); - m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); - m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); - m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + m_MRCFilter->SetInput(GetParameterDoubleVectorImage("inf")); - SetParameterOutputImage("outc", m_CohSRFilter->GetOutput() ); // input : 4 x 1 complex channel | 10 complex channels + SetParameterOutputImage("outc", m_MRCFilter->GetOutput()); // input : 16 real channels | output : 6 complex channels - break; + break; + //*************************************** + //* BISTATIC * + //*************************************** - case 9: // SinclairToCovariance + case 8: // SinclairToCoherency - m_CovSRFilter = CovSRFilterType::New(); - m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); - m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); - m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + m_CohSRFilter = CohSRFilterType::New(); + m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); + m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); + m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); - SetParameterOutputImage("outc", m_CovSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels + SetParameterOutputImage("outc", m_CohSRFilter->GetOutput()); // input : 4 x 1 complex channel | 10 complex channels - break; + break; - case 10: // SinclairToCircularCovariance + case 9: // SinclairToCovariance - m_CCSRFilter = CCSRFilterType::New(); - m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); - m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); - m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + m_CovSRFilter = CovSRFilterType::New(); + m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); + m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); + m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); - SetParameterOutputImage("outc", m_CCSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels + SetParameterOutputImage("outc", m_CovSRFilter->GetOutput()); // input : 4 x 1 complex channel | output : 10 complex channels - break; + break; - //*************************************** - //* BOTH CASES * - //*************************************** + case 10: // SinclairToCircularCovariance + m_CCSRFilter = CCSRFilterType::New(); + m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); + m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); + m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); - case 11: // SinclairToMueller - m_MSRFilter = MSRFilterType::New(); + SetParameterOutputImage("outc", m_CCSRFilter->GetOutput()); // input : 4 x 1 complex channel | output : 10 complex channels - m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); - m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); - m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); - m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); + break; - SetParameterOutputImage("outf", m_MSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 16 real channels - break; + //*************************************** + //* BOTH CASES * + //*************************************** - case 12: // MuellerToPolarisationDegreeAndPowerImageFilter - m_MPDPFilter = MPDPFilterType::New(); + case 11: // SinclairToMueller + m_MSRFilter = MSRFilterType::New(); - m_MPDPFilter->SetInput(GetParameterDoubleVectorImage("inf")); + m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); + m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); + m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); + m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv")); - SetParameterOutputImage("outf", m_MPDPFilter->GetOutput() ); // input : 16 real channels | output : 4 real channels + SetParameterOutputImage("outf", m_MSRFilter->GetOutput()); // input : 4 x 1 complex channel | output : 16 real channels - break; + break; - } + case 12: // MuellerToPolarisationDegreeAndPowerImageFilter + m_MPDPFilter = MPDPFilterType::New(); + m_MPDPFilter->SetInput(GetParameterDoubleVectorImage("inf")); + SetParameterOutputImage("outf", m_MPDPFilter->GetOutput()); // input : 16 real channels | output : 4 real channels + + break; + } } - //Monostatic + // Monostatic RCohSRFilterType::Pointer m_RCohSRFilter; RCovSRFilterType::Pointer m_RCovSRFilter; RCCSRFilterType::Pointer m_RCCSRFilter; @@ -593,23 +584,18 @@ private: RCRCFilterType::Pointer m_RCRCFilter; RLCRCCFilterType::Pointer m_RLCRCCFilter; - //Bistatic + // Bistatic CohSRFilterType::Pointer m_CohSRFilter; CovSRFilterType::Pointer m_CovSRFilter; CCSRFilterType::Pointer m_CCSRFilter; MSRFilterType::Pointer m_MSRFilter; - //Both cases - MRCFilterType::Pointer m_MRCFilter; - MPDPFilterType::Pointer m_MPDPFilter; - - - - - + // Both cases + MRCFilterType::Pointer m_MRCFilter; + MPDPFilterType::Pointer m_MPDPFilter; }; -} //end namespace Wrapper -} //end namespace otb +} // end namespace Wrapper +} // end namespace otb OTB_APPLICATION_EXPORT(otb::Wrapper::SARPolarMatrixConvert) diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h index dabc7bc88db3843ad9a8ee88b0cf41b1a57d9041..8a58cd100ced04c75198c4d1d1164f188741d0ad 100644 --- a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h @@ -19,10 +19,9 @@ */ -#ifndef otbMuellerToPolarisationDegreeAndPowerImageFilter_h -#define otbMuellerToPolarisationDegreeAndPowerImageFilter_h +#ifndef otbMuellerToPolarisationDegreeAndPowerFunctor_h +#define otbMuellerToPolarisationDegreeAndPowerFunctor_h -#include "otbUnaryFunctorImageFilter.h" #include "itkNumericTraits.h" #include "itkMatrix.h" #include "itkVector.h" @@ -84,7 +83,7 @@ public: typedef itk::Matrix<double, 4, 4> MuellerMatrixType; typedef itk::Vector<double, 4> StokesVectorType; - inline TOutput operator()( const TInput & Mueller ) const + inline void operator()( TOutput & result, const TInput & Mueller ) const { double P; double deg_pol; @@ -98,9 +97,6 @@ public: double l_PolarisationDegreeMin(itk::NumericTraits<double>::max()); double l_PolarisationDegreeMax(itk::NumericTraits<double>::min()); - TOutput result; - result.SetSize(m_NumberOfComponentsPerPixel); - MuellerMatrixType muellerMatrix; muellerMatrix[0][0] = Mueller[0]; muellerMatrix[0][1] = Mueller[1]; @@ -172,9 +168,6 @@ public: result[1] = l_PowerMax; result[2] = l_PolarisationDegreeMin; result[3] = l_PolarisationDegreeMax; - - - return result; } unsigned int GetOutputSize() @@ -182,6 +175,12 @@ public: return m_NumberOfComponentsPerPixel; } + constexpr size_t OutputSize(...) const + { + // Size of the result + return 4; + } + /** Constructor */ MuellerToPolarisationDegreeAndPowerFunctor() : m_NumberOfComponentsPerPixel(4), m_Epsilon(1e-6), m_PI_90(2*CONST_PI_180) {} @@ -193,49 +192,7 @@ private: const double m_Epsilon; const double m_PI_90; }; -} - - -/** \class otbMuellerToPolarisationDegreeAndPowerImageFilter - * \brief Compute the polarization degree and power (4 channels : Power min and max, Polarization degree min and max) - * from the Mueller image (16 real channels) - * For more details, please refer to the class MuellerToPolarisationDegreeAndPowerFunctor. - * - * \ingroup SARPolarimetry - * \sa MuellerToPolarisationDegreeAndPowerFunctor - * - * - * \ingroup OTBPolarimetry - */ -template <class TInputImage, class TOutputImage> -class ITK_EXPORT MuellerToPolarisationDegreeAndPowerImageFilter : - public UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::MuellerToPolarisationDegreeAndPowerFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> > -{ -public: - /** Standard class typedefs. */ - typedef MuellerToPolarisationDegreeAndPowerImageFilter Self; - typedef typename Functor::MuellerToPolarisationDegreeAndPowerFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType; - typedef UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctionType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(MuellerToPolarisationDegreeAndPowerImageFilter, UnaryFunctorImageFilter); - - -protected: - MuellerToPolarisationDegreeAndPowerImageFilter() {} - ~MuellerToPolarisationDegreeAndPowerImageFilter() override {} - -private: - MuellerToPolarisationDegreeAndPowerImageFilter(const Self&) = delete; - void operator=(const Self&) = delete; -}; +} // end namespace functor } // end namespace otb diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h index 6e078f7cb57e688a0d37c0d28c5f363383b53b9d..a6815a8f33fe0f6086d7eb18fc25f907e9795761 100644 --- a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h @@ -72,11 +72,8 @@ public: typedef typename TOutput::ValueType OutputValueType; - inline TOutput operator()( const TInput & Mueller ) const + inline void operator()( TOutput & result, const TInput & Mueller ) const { - TOutput result; - result.SetSize(m_NumberOfComponentsPerPixel); - // Keep the upper diagonal of the matrix const double M11 = static_cast<double>(Mueller[0]); const double M12 = static_cast<double>(Mueller[1]); @@ -89,7 +86,7 @@ public: const double M34 = static_cast<double>(Mueller[11]); const double M44 = static_cast<double>(Mueller[15]); - + const ComplexType A(0.5*(M11+M22+2*M12)); const ComplexType B(0.5*std::sqrt(2.0)*(M13+M23), 0.5*std::sqrt(2.0)*(M14+M24)); const ComplexType C(-0.5*(M33+M44), -M34); @@ -103,67 +100,21 @@ public: result[3] = static_cast<OutputValueType>( E ); result[4] = static_cast<OutputValueType>( F ); result[5] = static_cast<OutputValueType>( I ); - - return result; } - unsigned int GetOutputSize() - { - return m_NumberOfComponentsPerPixel; - } + constexpr size_t OutputSize(...) const + { + // Size of the result + return 6; + } /** Constructor */ - MuellerToReciprocalCovarianceFunctor() : m_NumberOfComponentsPerPixel(6) {} + MuellerToReciprocalCovarianceFunctor() {} /** Destructor */ virtual ~MuellerToReciprocalCovarianceFunctor() {} - - private: - unsigned int m_NumberOfComponentsPerPixel; -}; -} - - -/** \class otbMuellerToReciprocalCovarianceImageFilter - * \brief Compute the MLC image - * from the Mueller image (16 real channels) - * For more details, lease refer to the class MuellerToReciprocalCovarianceFunctor. - * - * \ingroup SARPolarimetry - * \sa MuellerToReciprocalCovarianceFunctor - * - * - * \ingroup OTBPolarimetry - */ -template <class TInputImage, class TOutputImage> -class ITK_EXPORT MuellerToReciprocalCovarianceImageFilter : - public UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::MuellerToReciprocalCovarianceFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> > -{ -public: - /** Standard class typedefs. */ - typedef MuellerToReciprocalCovarianceImageFilter Self; - typedef Functor::MuellerToReciprocalCovarianceFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType; - typedef UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctionType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(MuellerToReciprocalCovarianceImageFilter, UnaryFunctorImageFilter); - - -protected: - MuellerToReciprocalCovarianceImageFilter() {} - ~MuellerToReciprocalCovarianceImageFilter() override {} - -private: - MuellerToReciprocalCovarianceImageFilter(const Self&) = delete; - void operator=(const Self&) = delete; }; +} // end namespace functor } // end namespace otb diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h similarity index 56% rename from Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h rename to Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h index 2e584c720344e8d0ffe1c1ad76f8f4373ba3f26a..c0cc0e3b403932c7e3d40757d9da67fb1972f737 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h @@ -33,7 +33,7 @@ namespace otb namespace Functor { /** \class otbBarnesDecompFunctor - * + * * \brief Evaluate the Huynen decomposition from the reciprocal Sinclair matrix image. * * \ingroup OTBPolarimetry @@ -49,14 +49,11 @@ public: typedef std::vector<double> VectorType; typedef typename TOutput::ValueType OutputValueType; + inline void operator()( TOutput & result, const TInput & Covariance ) const + { + + VNLMatrixType qi(3,1); - inline TOutput operator()( const TInput & Covariance ) const - { - TOutput result; - result.SetSize(m_NumberOfComponentsPerPixel); - - VNLMatrixType qi(3,1); - VNLMatrixType cov(3, 3); cov[0][0] = ComplexType(Covariance[0]); @@ -70,43 +67,47 @@ 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]); - - return result; - } + } unsigned int GetOutputSize() { return m_NumberOfComponentsPerPixel; } + constexpr size_t OutputSize(...) const + { + // Size of the result + return 9; + } + /** Constructor */ ReciprocalBarnesDecompFunctor() : m_Epsilon(1e-6) {} @@ -117,48 +118,7 @@ private: itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 9); const double m_Epsilon; }; -} - - -/** \class otbBarnesDecompImageFilter - * \brief Compute the Barnes decomposition image (9 complex channels) - * from the Reciprocal Covariance image (6 complex channels) - * - * For more details, please refer to the class ReciprocalBarnesDecompFunctor. - * - * \ingroup OTBPolarimetry - * \sa ReciprocalBarnesDecompFunctor - */ -template <class TInputImage, class TOutputImage> -class ITK_EXPORT ReciprocalBarnesDecompImageFilter : - public otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalBarnesDecompFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> > -{ -public: - /** Standard class typedefs. */ - typedef ReciprocalBarnesDecompImageFilter Self; - typedef typename Functor::ReciprocalBarnesDecompFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType; - typedef otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctionType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(ReciprocalBarnesDecompImageFilter, UnaryFunctorImageFilter); - -protected: - ReciprocalBarnesDecompImageFilter() {} - ~ReciprocalBarnesDecompImageFilter() override {} - -private: - ReciprocalBarnesDecompImageFilter(const Self&) = delete; - void operator=(const Self&) = delete; - -}; - +} // end namespace functor } // end namespace otb #endif diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h similarity index 77% rename from Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h rename to Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h index 04c7035f9315a6ea6a314b16b8aed9599bfa6c09..8a146f43246526e314678e798bbf363886f3f91c 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h @@ -67,11 +67,8 @@ public: typedef typename TOutput::ValueType OutputValueType; - inline TOutput operator()( const TInput & Coherency ) const + inline void operator()( TOutput & result, const TInput & Coherency ) const { - TOutput result; - result.SetSize(m_NumberOfComponentsPerPixel); - const double T0 = static_cast<double>(Coherency[0].real()); const double T1 = static_cast<double>(Coherency[3].real()); const double T2 = static_cast<double>(Coherency[5].real()); @@ -128,11 +125,11 @@ public: totalEigenValues += sortedRealEigenValues[k]; } - + for (unsigned int k = 0; k < 3; ++k) { p[k] = sortedRealEigenValues[k] / totalEigenValues; - + if (p[k]<m_Epsilon) //n=log(n)-->0 when n-->0 plog[k]=0.0; else @@ -162,72 +159,28 @@ public: // Anisotropy estimation anisotropy=(sortedRealEigenValues[1] - sortedRealEigenValues[2])/(sortedRealEigenValues[1] + sortedRealEigenValues[2] + m_Epsilon); - result[0] = static_cast<OutputValueType>(entropy); result[1] = static_cast<OutputValueType>(alpha); result[2] = static_cast<OutputValueType>(anisotropy); - - return result; } - unsigned int GetOutputSize() - { - return m_NumberOfComponentsPerPixel; - } + constexpr size_t OutputSize(...) const + { + // Size of the result (entropy, alpha, anisotropy) + return 3; + } /** Constructor */ - ReciprocalHAlphaFunctor() : m_Epsilon(1e-6) {} + ReciprocalHAlphaFunctor() {} /** Destructor */ virtual ~ReciprocalHAlphaFunctor() {} private: itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 3); - const double m_Epsilon; -}; -} - - -/** \class otbHAlphaImageFilter - * \brief Compute the H-Alpha image (3 channels) - * from the Reciprocal coherency image (6 complex channels) - * - * For more details, please refer to the class ReciprocalHAlphaFunctor. - * - * \ingroup OTBPolarimetry - * \sa ReciprocalHAlphaFunctor - * - */ -template <class TInputImage, class TOutputImage> -class ITK_EXPORT ReciprocalHAlphaImageFilter : - public otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalHAlphaFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> > -{ -public: - /** Standard class typedefs. */ - typedef ReciprocalHAlphaImageFilter Self; - typedef typename Functor::ReciprocalHAlphaFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType; - typedef otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctionType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(ReciprocalHAlphaImageFilter, UnaryFunctorImageFilter); - -protected: - ReciprocalHAlphaImageFilter() {} - ~ReciprocalHAlphaImageFilter() override {} - -private: - ReciprocalHAlphaImageFilter(const Self&) = delete; - void operator=(const Self&) = delete; - + static constexpr double m_Epsilon = 1e-6; }; - +} // end namespace functor } // end namespace otb #endif diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h similarity index 59% rename from Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h rename to Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h index 9522a3dc54f21098973ebe4552ff697faf10bb24..4ab534e4512fca80f658983e2eb28df5200b7e3d 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h @@ -22,16 +22,13 @@ #ifndef otbReciprocalHuynenDecompImageFilter_h #define otbReciprocalHuynenDecompImageFilter_h -#include "otbUnaryFunctorImageFilter.h" - - namespace otb { namespace Functor { /** \class ReciprocalHuynenDecompFunctor - * + * * \brief Evaluate the Huynen decomposition from the reciprocal Sinclair matrix image. * * \ingroup OTBPolarimetry @@ -44,11 +41,8 @@ public: typedef typename TOutput::ValueType OutputValueType; - inline TOutput operator()( const TInput & Covariance ) const + inline void operator()( TOutput & result, const TInput & Covariance ) const { - TOutput result; - result.SetSize(m_NumberOfComponentsPerPixel); - OutputValueType A0 = static_cast<OutputValueType>(Covariance[0].real() / 2.0); OutputValueType B0 = static_cast<OutputValueType>((Covariance[3] + Covariance[5]).real() / 2.0); OutputValueType B = static_cast<OutputValueType>(Covariance[3].real() - B0); @@ -58,7 +52,7 @@ public: OutputValueType F = static_cast<OutputValueType>(Covariance[4].imag()); OutputValueType G = static_cast<OutputValueType>(Covariance[2].imag()); OutputValueType H = static_cast<OutputValueType>(Covariance[2].real()); - + result[0] = A0; result[1] = B0; result[2] = B; @@ -68,8 +62,6 @@ public: result[6] = F; result[7] = G; result[8] = H; - - return result; } unsigned int GetOutputSize() @@ -77,6 +69,12 @@ public: return m_NumberOfComponentsPerPixel; } + constexpr size_t OutputSize(...) const + { + // Size of the result + return 9; + } + /** Constructor */ ReciprocalHuynenDecompFunctor() : m_Epsilon(1e-6) {} @@ -87,49 +85,7 @@ private: itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 9); const double m_Epsilon; }; -} - - -/** \class ReciprocalHuynenDecompImageFilter - * \brief Compute the Huynen decomposition image (9 complex channels) - * from the Reciprocal Covariance image (6 complex channels) - * - * For more details, please refer to the class ReciprocalHuynenDecompFunctor. - * - * \ingroup OTBPolarimetry - * \sa ReciprocalHuynenDecompFunctor - * - */ -template <class TInputImage, class TOutputImage> -class ITK_EXPORT ReciprocalHuynenDecompImageFilter : - public otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalHuynenDecompFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> > -{ -public: - /** Standard class typedefs. */ - typedef ReciprocalHuynenDecompImageFilter Self; - typedef typename Functor::ReciprocalHuynenDecompFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType; - typedef otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctionType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(ReciprocalHuynenDecompImageFilter, UnaryFunctorImageFilter); - -protected: - ReciprocalHuynenDecompImageFilter() {} - ~ReciprocalHuynenDecompImageFilter() override {} - -private: - ReciprocalHuynenDecompImageFilter(const Self&) = delete; - void operator=(const Self&) = delete; - -}; - +} // end namespace functor } // end namespace otb #endif diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h similarity index 53% rename from Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h rename to Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h index 6fdd423457435481485bc1cb9f190cec1144666c..ce7019fb1729cf4c3be4a4a68bdbadc0eac6d88b 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h @@ -22,16 +22,13 @@ #ifndef otbReciprocalPauliDecompImageFilter_h #define otbReciprocalPauliDecompImageFilter_h -#include "otbUnaryFunctorImageFilter.h" - - namespace otb { namespace Functor { /** \class ReciprocalPauliDecompFunctor - * + * * \brief Evaluate the Pauli decomposition from the reciprocal Sinclair matrix image. * * \ingroup OTBPolarimetry @@ -45,22 +42,17 @@ public: typedef typename TOutput::ValueType OutputValueType; - inline TOutput operator()( const TInput & Sinclair ) const + inline void operator()( TOutput & result, const TInput & Sinclair ) const { - TOutput result; - result.SetSize(m_NumberOfComponentsPerPixel); - InputValueType sqrt2(std::sqrt(2.0),0.0); - + InputValueType Shh = static_cast<InputValueType>(Sinclair[0]); InputValueType Shv = static_cast<InputValueType>(Sinclair[1]); InputValueType Svv = static_cast<InputValueType>(Sinclair[2]); - + result[0] = (Shh+Svv)/sqrt2; result[1] = (Shh-Svv)/sqrt2; result[2] = sqrt2*Shv; - - return result; } unsigned int GetOutputSize() @@ -68,6 +60,12 @@ public: return m_NumberOfComponentsPerPixel; } + constexpr size_t OutputSize(...) const + { + // Size of the result + return 3; + } + /** Constructor */ ReciprocalPauliDecompFunctor() : m_Epsilon(1e-6) {} @@ -78,49 +76,7 @@ private: itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 3); const double m_Epsilon; }; -} - - -/** \class ReciprocalPauliDecompImageFilter - * \brief Compute the Pauli decomposition image (3 complex channels) - * from the Reciprocal Sinclair image (6 complex channels) - * - * For more details, please refer to the class ReciprocalPauliDecompFunctor. - * - * \ingroup OTBPolarimetry - * \sa ReciprocalPauliDecompFunctor - * - */ -template <class TInputImage, class TOutputImage> -class ITK_EXPORT ReciprocalPauliDecompImageFilter : - public otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::ReciprocalPauliDecompFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> > -{ -public: - /** Standard class typedefs. */ - typedef ReciprocalPauliDecompImageFilter Self; - typedef typename Functor::ReciprocalPauliDecompFunctor< - typename TInputImage::PixelType, typename TOutputImage::PixelType> FunctionType; - typedef otb::UnaryFunctorImageFilter<TInputImage, TOutputImage, FunctionType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(ReciprocalPauliDecompImageFilter, UnaryFunctorImageFilter); - -protected: - ReciprocalPauliDecompImageFilter() {this->SetNumberOfThreads(1);} - ~ReciprocalPauliDecompImageFilter() override {} - -private: - ReciprocalPauliDecompImageFilter(const Self&) = delete; - void operator=(const Self&) = delete; - -}; - +} // end namespace functor } // end namespace otb #endif diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilters.h b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilters.h index 8fbf37d0b9fec28622249bb726bdc3c1656e5a52..2dc5a529a3b973ee097eb2c0216320e2ad320591 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilters.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilters.h @@ -36,8 +36,18 @@ #include "otbSinclairToReciprocalCovarianceMatrixFunctor.h" #include "otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h" +// Decomposition functors +#include "otbReciprocalBarnesDecompFunctor.h" +#include "otbReciprocalHAlphaImageFunctor.h" +#include "otbReciprocalHuynenDecompFunctor.h" +#include "otbReciprocalPauliDecompFunctor.h" + namespace otb { +//################# +// Bistatic filters +//################# + // This is the entire declaration of SinclairToCovarianceMatrixFilter template <typename TInputImage, typename TOutputImage> using SinclairToCovarianceMatrixFilter = FunctorImageFilter< @@ -49,43 +59,86 @@ using SinclairToCovarianceMatrixFilter = FunctorImageFilter< template <typename TInputImage, typename TOutputImage> using SinclairToCircularCovarianceMatrixFilter = FunctorImageFilter< Functor::SinclairToCircularCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType, - typename TInputImage::PixelType, typename TOutputImage::PixelType>, + typename TInputImage::PixelType, typename TOutputImage::PixelType>, std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>; // This is the entire declaration of SinclairToCoherencyMatrixFilter template <typename TInputImage, typename TOutputImage> using SinclairToCoherencyMatrixFilter = FunctorImageFilter< Functor::SinclairToCoherencyMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType, - typename TInputImage::PixelType, typename TOutputImage::PixelType>, + typename TInputImage::PixelType, typename TOutputImage::PixelType>, std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>; // This is the entire declaration of SinclairToMuellerMatrixFilter template <typename TInputImage, typename TOutputImage> using SinclairToMuellerMatrixFilter = FunctorImageFilter< Functor::SinclairToMuellerMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType, - typename TInputImage::PixelType, typename TOutputImage::PixelType>, + typename TInputImage::PixelType, typename TOutputImage::PixelType>, std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>; +//################### // Monostatic filters -// Convert the Sinclair reciprocal matrix +//################### + +// This is the entire declaration of SinclairToReciprocalCoherencyMatrixFilter +template <typename TInputImage, typename TOutputImage> +using SinclairToReciprocalCoherencyMatrixFilter = + FunctorImageFilter<Functor::SinclairToReciprocalCoherencyMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, + typename TInputImage::PixelType, typename TOutputImage::PixelType>, + std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>; + +// This is the entire declaration of SinclairToReciprocalCoherencyMatrixFilter +template <typename TInputImage, typename TOutputImage> +using SinclairToReciprocalCovarianceMatrixFilter = + FunctorImageFilter<Functor::SinclairToReciprocalCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, + typename TInputImage::PixelType, typename TOutputImage::PixelType>, + std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>; + +// This is the entire declaration of SinclairToReciprocalCircularCovarianceMatrixFilter +template <typename TInputImage, typename TOutputImage> +using SinclairToReciprocalCircularCovarianceMatrixFilter = + FunctorImageFilter<Functor::SinclairToReciprocalCircularCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, + typename TInputImage::PixelType, typename TOutputImage::PixelType>, + std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>; + + +//############################ +// Polarimetric decompositions +//############################ + +// This is the entire declaration of ReciprocalHAlphaImageFilter +template <typename TInputImage, typename TOutputImage> +using ReciprocalHAlphaImageFilter = + FunctorImageFilter<Functor::ReciprocalHAlphaFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>; -// SinclairToReciprocalCoherencyMatrixFilter +// This is the entire declaration of ReciprocalBarnesDecompImageFilter template <typename TInputImage, typename TOutputImage> -using SinclairToReciprocalCoherencyMatrixFilter = FunctorImageFilter< - Functor::SinclairToReciprocalCoherencyMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType,typename TInputImage::PixelType, typename TOutputImage::PixelType>, - std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>; +using ReciprocalBarnesDecompImageFilter = + FunctorImageFilter<Functor::ReciprocalBarnesDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>; + +// This is the entire declaration of ReciprocalHuynenDecompImageFilter +template <typename TInputImage, typename TOutputImage> +using ReciprocalHuynenDecompImageFilter = + FunctorImageFilter<Functor::ReciprocalHuynenDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>; + +// This is the entire declaration of ReciprocalPauliDecompImageFilter +template <typename TInputImage, typename TOutputImage> +using ReciprocalPauliDecompImageFilter = + FunctorImageFilter<Functor::ReciprocalPauliDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>; + +//################ +// Mueller filters +//################ -// SinclairToReciprocalCoherencyMatrixFilter +// This is the entire declaration of MuellerToPolarisationDegreeAndPowerFilter template <typename TInputImage, typename TOutputImage> -using SinclairToReciprocalCovarianceMatrixFilter = FunctorImageFilter< - Functor::SinclairToReciprocalCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType,typename TInputImage::PixelType, typename TOutputImage::PixelType>, - std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>; +using MuellerToPolarisationDegreeAndPowerImageFilter = + FunctorImageFilter<Functor::MuellerToPolarisationDegreeAndPowerFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>; -// SinclairToReciprocalCircularCovarianceMatrixFilter +// This is the entire declaration of MuellerToReciprocalCovarianceImageFilter template <typename TInputImage, typename TOutputImage> -using SinclairToReciprocalCircularCovarianceMatrixFilter = FunctorImageFilter< - Functor::SinclairToReciprocalCircularCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType,typename TInputImage::PixelType, typename TOutputImage::PixelType>, - std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>; +using MuellerToReciprocalCovarianceImageFilter = + FunctorImageFilter<Functor::MuellerToReciprocalCovarianceFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>; diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h deleted file mode 100644 index 1ccee11854fa4c7e003baa5330905027221d8d52..0000000000000000000000000000000000000000 --- a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbSinclairReciprocalImageFilter_h -#define otbSinclairReciprocalImageFilter_h - -#include "itkTernaryFunctorImageFilter.h" -#include "otbSinclairToReciprocalCovarianceMatrixFunctor.h" -#include <complex> - -namespace otb -{ - -/** \class SinclairReciprocalImageFilter - * \brief Convert the Sinclair reciprocal matrix. - * - * This class is parameterized over the type of the input images and - * the type of the output image. It is also parameterized by the - * operation to be applied, using a Functor style. - * - * The output image has 6 channels : the diagonal and the upper element of the reciprocal matrix. - * Element a sotored from left to right, line by line. - * - * The class is templated by the 3 input image (HH, HV_VH and VV) and the used functor. - * Available functors are : - * - SinclairToReciprocalCovarianceMatrixFunctor (default one) - * - SinclairToReciprocalCircularCovarianceMatrixFunctor - * - SinclairToReciprocalCoherencyMatrixFunctor - * - * \ingroup SARPolarimetry - * - * \sa SinclairImageFilter - * \sa SinclairToReciprocalCircularCovarianceMatrixFunctor - * \sa SinclairToReciprocalCoherencyMatrixFunctor - * \sa SinclairToReciprocalCovarianceMatrixFunctor - * - * - * \ingroup OTBPolarimetry - */ - - -template <class TInputImageHH, class TInputImageHV_VH, - class TInputImageVV, class TOutputImage, - class TFunction = Functor::SinclairToReciprocalCovarianceMatrixFunctor< - typename TInputImageHH::PixelType, - typename TInputImageHV_VH::PixelType, - typename TInputImageVV::PixelType, - typename TOutputImage::PixelType> > -class ITK_EXPORT SinclairReciprocalImageFilter : public itk::TernaryFunctorImageFilter<TInputImageHH, - TInputImageHV_VH, TInputImageVV, - TOutputImage, TFunction> -{ -public: - - /** Standard typedefs */ - typedef SinclairReciprocalImageFilter Self; - typedef itk::TernaryFunctorImageFilter<TInputImageHH, TInputImageHV_VH, - TInputImageVV, TOutputImage, TFunction> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(SinclairReciprocalImageFilter, itk::TernaryFunctorImageFilter); - - /** Template parameters typedefs */ - typedef typename Superclass::Input1ImageType HHInputImageType; - typedef typename Superclass::Input1ImagePointer HHInputImagePointer; - typedef typename Superclass::Input2ImageType HV_VHInputImageType; - typedef typename Superclass::Input2ImagePointer HV_VHInputImagePointer; - typedef typename Superclass::Input3ImageType VVInputImageType; - typedef typename Superclass::Input3ImagePointer VVInputImagePointer; - typedef typename Superclass::OutputImageType OutputImageType; - typedef typename OutputImageType::Pointer OutputImagePointer; - typedef typename OutputImageType::RegionType OutputImageRegionType; - typedef typename Superclass::FunctorType FunctorType; - - void SetInputHH(const TInputImageHH * image); - // This method set the second input, same as SetInputVH - void SetInputHV(const TInputImageHV_VH * image); - // This method set the second input, same as SetInputHV - void SetInputVH(const TInputImageHV_VH * image); - // This method set the second input, same as SetInputHV and SetInputHV - void SetInputHV_VH(const TInputImageHV_VH * image); - void SetInputVV(const TInputImageVV * image); - - -protected: - /** Constructor */ - SinclairReciprocalImageFilter() {} - /** Destructor */ - ~SinclairReciprocalImageFilter() override {} - - void GenerateOutputInformation() override; - - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - - SinclairReciprocalImageFilter(const Self &) = delete; - void operator =(const Self&) = delete; - -}; - - -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbSinclairReciprocalImageFilter.hxx" -#endif - -#endif diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.hxx b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.hxx deleted file mode 100644 index 37549c96926854a4581898db6439b12cc89d4516..0000000000000000000000000000000000000000 --- a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbSinclairReciprocalImageFilter_hxx -#define otbSinclairReciprocalImageFilter_hxx - -#include "otbSinclairReciprocalImageFilter.h" -#include "otbMath.h" - -namespace otb -{ - -/** - * Connect one of the operands for pixel-wise addition - */ -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::SetInputHH(const TInputImageHH * image) -{ - this->SetInput1(image); -} - -/** - * Connect one of the operands for pixel-wise addition - */ -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::SetInputHV(const TInputImageHV_VH * image) -{ - this->SetInput2(image); -} - -/** - * Connect one of the operands for pixel-wise addition - */ -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::SetInputVH(const TInputImageHV_VH * image) -{ - this->SetInput2(image); -} - -/** - * Connect one of the operands for pixel-wise addition - */ -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::SetInputHV_VH(const TInputImageHV_VH * image) -{ - this->SetInput2(image); -} - -/** - * Connect one of the operands for pixel-wise addition - */ -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::SetInputVV(const TInputImageVV * image) -{ - this->SetInput3(image); -} - -/** - * Printself - */ -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -template <class TInputImageHH, class TInputImageHV_VH, class TInputImageVV, class TOutputImage, class TFunction> -void -SinclairReciprocalImageFilter<TInputImageHH, TInputImageHV_VH, TInputImageVV, TOutputImage, TFunction> -::GenerateOutputInformation() -{ - // Call to the superclass implementation - Superclass::GenerateOutputInformation(); - typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); - - // initialize the number of channels of the output image - outputPtr->SetNumberOfComponentsPerPixel( this->GetFunctor().GetNumberOfComponentsPerPixel() ); - -} - -} // end namespace otb - -#endif diff --git a/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx index d1d9d953e8d1947970649e9096c1981d50e2560a..e5cda3f7dd5bc4aa49c3009a89e497616f8fd08f 100644 --- a/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx +++ b/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx @@ -34,7 +34,7 @@ int otbMuellerToReciprocalCovarianceFunctor(int itkNotUsed(argc), char * itkNotU VectorDoubleType input; input.SetSize(16); - VectorComplexType outputFunct; + VectorComplexType outputFunct(6); outputFunct.SetSize(6); VectorComplexType result; result.SetSize(6); @@ -54,7 +54,7 @@ int otbMuellerToReciprocalCovarianceFunctor(int itkNotUsed(argc), char * itkNotU result[5] = ComplexType(0.75,0); FunctorType funct; - outputFunct = funct.operator ()( input ); + funct.operator ()( outputFunct, input ); std::cout<<outputFunct<<std::endl; if( std::abs(result[0].real()-outputFunct[0].real()) > 1e-10 || diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx index c18bd11ed30cf87d534875bdeefb13661e1a4f51..f90b2aa754311c7ede92d4aacc9ee4ae365bb90a 100644 --- a/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx +++ b/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx @@ -27,7 +27,6 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "itkMeanImageFilter.h" -#include "otbReciprocalBarnesDecompImageFilter.h" #include "otbPerBandVectorImageFilter.h" #include "otbSinclairImageFilters.h" @@ -89,7 +88,7 @@ int otbReciprocalBarnesDecompImageFilter(int itkNotUsed(argc), char * argv[]) perBand->SetInput(sinclairtocov->GetOutput()); - barnesfilter->SetInput(perBand->GetOutput()); + barnesfilter->SetInput1(perBand->GetOutput()); writer->SetFileName(outputFilename); writer->SetInput(barnesfilter->GetOutput()); diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx index bfb6dc969698966f9b34094127dd693e5418d6e8..d91941e8fc96141a296d9e224291e70e29f8eadd 100644 --- a/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx +++ b/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx @@ -26,7 +26,6 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -#include "otbReciprocalHAlphaImageFilter.h" #include "itkMeanImageFilter.h" #include "otbPerBandVectorImageFilter.h" @@ -88,7 +87,7 @@ int otbReciprocalHAlphaImageFilter(int itkNotUsed(argc), char * argv[]) perBand->SetInput(sinclairtocov->GetOutput()); - haafilter->SetInput(perBand->GetOutput()); + haafilter->SetInput1(perBand->GetOutput()); writer->SetFileName(outputFilename); writer->SetInput(haafilter->GetOutput()); diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx index 31bf2e5674f6ecb5c5423d7a9d7784f829a6fa4d..324b304b48a405530405b71a5a559a257ed05120 100644 --- a/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx +++ b/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "itkMeanImageFilter.h" -#include "otbReciprocalHuynenDecompImageFilter.h" + #include "otbPerBandVectorImageFilter.h" #include "otbSinclairImageFilters.h" @@ -85,7 +85,7 @@ int otbReciprocalHuynenDecompImageFilter(int itkNotUsed(argc), char * argv[]) perBand->SetInput(sinclairtocov->GetOutput()); - huynenfilter->SetInput(perBand->GetOutput()); + huynenfilter->SetInput1(perBand->GetOutput()); writer->SetFileName(outputFilename); writer->SetInput(huynenfilter->GetOutput()); diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalPauliDecomp.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalPauliDecomp.cxx index 587a33ef650ba410fe03e669b033af6929387180..20e9cc6cbceb4f3d227753b9242e9022139acf9a 100644 --- a/Modules/Filtering/Polarimetry/test/otbReciprocalPauliDecomp.cxx +++ b/Modules/Filtering/Polarimetry/test/otbReciprocalPauliDecomp.cxx @@ -26,9 +26,10 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -#include "otbReciprocalPauliDecompImageFilter.h" + #include "otbNRIBandImagesToOneNComplexBandsImage.h" +#include "otbSinclairImageFilters.h" int otbReciprocalPauliDecompImageFilter(int itkNotUsed(argc), char * argv[]) @@ -50,25 +51,25 @@ int otbReciprocalPauliDecompImageFilter(int itkNotUsed(argc), char * argv[]) typedef otb::ImageFileReader<RealVectorImageType> ReaderType; typedef otb::ImageFileWriter<ComplexVectorImageType> WriterType; - + typedef otb::ReciprocalPauliDecompImageFilter<ComplexVectorImageType, ComplexVectorImageType> FilterType; - + ReaderType::Pointer readerHH = ReaderType::New(); ReaderType::Pointer readerHV = ReaderType::New(); ReaderType::Pointer readerVV = ReaderType::New(); NRITOOneCFilterType::Pointer nriToOneCfilter = NRITOOneCFilterType::New(); WriterType::Pointer writer = WriterType::New(); FilterType::Pointer paulifilter = FilterType::New(); - + readerHH->SetFileName(inputFilenameHH); readerHV->SetFileName(inputFilenameHV); readerVV->SetFileName(inputFilenameVV); - + nriToOneCfilter->SetInput(0,readerHH->GetOutput()); nriToOneCfilter->SetInput(1,readerHV->GetOutput()); nriToOneCfilter->SetInput(2,readerVV->GetOutput()); - - paulifilter->SetInput(nriToOneCfilter->GetOutput()); + + paulifilter->SetInput1(nriToOneCfilter->GetOutput()); writer->SetFileName(outputFilename); writer->SetInput(paulifilter->GetOutput());