From f75252f651e64ad5a4b4caec3d7438c7df57d77d Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@cnes.fr>
Date: Mon, 17 Dec 2018 17:56:18 +0100
Subject: [PATCH] ENH: disagregate sinclair mono and bistatic filters in
 separate headers (kmn)

---
 .../app/otbSARDecompositions.cxx              |  3 +-
 .../app/otbSARPolarMatrixConvert.cxx          | 23 ++++++----
 .../include/otbPolarimetricFilters.h          | 38 -----------------
 .../include/otbReciprocalHAlphaImageFunctor.h |  2 +
 ...irToCircularCovarianceMatrixImageFilter.h} |  2 +-
 ...otbSinclairToCoherencyMatrixImageFilter.h} |  0
 ...tbSinclairToCovarianceMatrixImageFilter.h} |  0
 ...> otbSinclairToMuellerMatrixImageFilter.h} |  0
 ...ocalCircularCovarianceMatrixImageFilter.h} | 40 +++++++++++++-----
 ...rToReciprocalCoherencyMatrixImageFilter.h} | 42 ++++++++++++++-----
 ...ToReciprocalCovarianceMatrixImageFilter.h} | 39 +++++++++++++----
 .../test/otbReciprocalBarnesDecomp.cxx        |  4 +-
 .../test/otbReciprocalHAlphaImageFilter.cxx   |  3 +-
 .../test/otbReciprocalHuynenDecomp.cxx        |  3 +-
 .../test/otbSinclairImageFilter.cxx           | 15 ++++---
 .../test/otbSinclairReciprocalImageFilter.cxx | 10 +++--
 ...clairToCircularCovarianceMatrixFunctor.cxx |  2 +-
 .../otbSinclairToCoherencyMatrixFunctor.cxx   |  2 +-
 .../otbSinclairToCovarianceMatrixFunctor.cxx  |  2 +-
 .../otbSinclairToMuellerMatrixFunctor.cxx     |  2 +-
 ...iprocalCircularCovarianceMatrixFunctor.cxx |  2 +-
 ...lairToReciprocalCoherencyMatrixFunctor.cxx |  2 +-
 ...airToReciprocalCovarianceMatrixFunctor.cxx |  2 +-
 23 files changed, 142 insertions(+), 96 deletions(-)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToCircularCovarianceMatrixFunctor.h => otbSinclairToCircularCovarianceMatrixImageFilter.h} (99%)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToCoherencyMatrixFunctor.h => otbSinclairToCoherencyMatrixImageFilter.h} (100%)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToCovarianceMatrixFunctor.h => otbSinclairToCovarianceMatrixImageFilter.h} (100%)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToMuellerMatrixFunctor.h => otbSinclairToMuellerMatrixImageFilter.h} (100%)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h => otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h} (69%)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToReciprocalCoherencyMatrixFunctor.h => otbSinclairToReciprocalCoherencyMatrixImageFilter.h} (72%)
 rename Modules/Filtering/Polarimetry/include/{otbSinclairToReciprocalCovarianceMatrixFunctor.h => otbSinclairToReciprocalCovarianceMatrixImageFilter.h} (70%)

diff --git a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx
index 86788c3694..71320a1bcc 100644
--- a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx
+++ b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx
@@ -28,6 +28,7 @@
 #include "otbImageListToVectorImageFilter.h"
 #include "otbImageList.h"
 
+#include "otbSinclairToReciprocalCoherencyMatrixImageFilter.h"
 
 namespace otb
 {
@@ -51,7 +52,7 @@ public:
                                     ComplexDoubleVectorImageType::PixelType>								FunctorType;
 
 
-  using SRFilterType = otb::SinclairToReciprocalCoherencyMatrixFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>;
+  using SRFilterType = otb::SinclairToReciprocalCoherencyMatrixImageFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>;
 
   typedef itk::MeanImageFilter<ComplexDoubleImageType, ComplexDoubleImageType>                                         MeanFilterType;
   typedef otb::PerBandVectorImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType, MeanFilterType>    PerBandMeanFilterType;
diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx
index b7749571eb..4e1c29c016 100644
--- a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx
+++ b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx
@@ -24,6 +24,15 @@
 // Polarimetric filters
 #include "otbPolarimetricFilters.h"
 
+#include "otbSinclairToCoherencyMatrixImageFilter.h"
+#include "otbSinclairToCovarianceMatrixImageFilter.h"
+#include "otbSinclairToCircularCovarianceMatrixImageFilter.h"
+#include "otbSinclairToMuellerMatrixImageFilter.h"
+
+#include "otbSinclairToReciprocalCoherencyMatrixImageFilter.h"
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
+#include "otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h"
+
 namespace otb
 {
 namespace Wrapper
@@ -39,9 +48,9 @@ public:
   typedef itk::SmartPointer<const Self> ConstPointer;
 
   // Monostatic case
-  using RCohSRFilterType = SinclairToReciprocalCoherencyMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
-  using RCovSRFilterType = SinclairToReciprocalCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
-  using RCCSRFilterType  = SinclairToReciprocalCircularCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
+  using RCohSRFilterType = SinclairToReciprocalCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
+  using RCovSRFilterType = SinclairToReciprocalCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
+  using RCCSRFilterType  = SinclairToReciprocalCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
 
   using RCRMFilterType = otb::ReciprocalCoherencyToReciprocalMuellerImageFilter<ComplexDoubleVectorImageType, DoubleVectorImageType>;
   using RCCDFilterType = otb::ReciprocalCovarianceToCoherencyDegreeImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType>;
@@ -50,10 +59,10 @@ public:
   using RLCRCCFilterType = otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType>;
 
   // Bistatic case
-  using CohSRFilterType = SinclairToCoherencyMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
-  using CovSRFilterType = SinclairToCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
-  using CCSRFilterType  = SinclairToCircularCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
-  using MSRFilterType   = SinclairToMuellerMatrixFilter<ComplexDoubleImageType, DoubleVectorImageType>;
+  using CohSRFilterType = SinclairToCoherencyMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
+  using CovSRFilterType = SinclairToCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
+  using CCSRFilterType  = SinclairToCircularCovarianceMatrixImageFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
+  using MSRFilterType   = SinclairToMuellerMatrixImageFilter<ComplexDoubleImageType, DoubleVectorImageType>;
 
   using MRCFilterType = otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType>;
   using MPDPFilterType = otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType>;
diff --git a/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h b/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h
index 367627599d..1d94d8a7b6 100644
--- a/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h
+++ b/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h
@@ -25,17 +25,6 @@
 #include "otbPolarimetryTags.h"
 #include "otbFunctorImageFilter.h"
 
-// Bistatic functors
-#include "otbSinclairToCovarianceMatrixFunctor.h"
-#include "otbSinclairToCircularCovarianceMatrixFunctor.h"
-#include "otbSinclairToCoherencyMatrixFunctor.h"
-#include "otbSinclairToMuellerMatrixFunctor.h"
-
-// Monostatic functors
-#include "otbSinclairToReciprocalCoherencyMatrixFunctor.h"
-#include "otbSinclairToReciprocalCovarianceMatrixFunctor.h"
-#include "otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h"
-
 // Decomposition functors
 #include "otbReciprocalBarnesDecompFunctor.h"
 #include "otbReciprocalHAlphaImageFunctor.h"
@@ -54,33 +43,6 @@
 
 namespace otb
 {
-
-//###################
-// Monostatic filters
-//###################
-
-// 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
 //############################
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h
index 58fcdf379b..f68bb0ef07 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h
@@ -25,6 +25,8 @@
 #include "otbMath.h"
 #include "vnl/algo/vnl_complex_eigensystem.h"
 #include <algorithm>
+#include <vector>
+#include <complex>
 
 namespace otb
  {
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixImageFilter.h
similarity index 99%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixImageFilter.h
index 0984c6a9c8..5ae4823a77 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixImageFilter.h
@@ -23,7 +23,7 @@
 
 #include <complex>
 
-#include "otbSinclairToCovarianceMatrixFunctor.h"
+#include "otbSinclairToCovarianceMatrixImageFilter.h"
 #include "otbFunctorImageFilter.h"
 #include "otbPolarimetryTags.h"
 
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixImageFilter.h
similarity index 100%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixImageFilter.h
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixImageFilter.h
similarity index 100%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixImageFilter.h
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixImageFilter.h
similarity index 100%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixImageFilter.h
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h
similarity index 69%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h
index 184dd753e0..edaddd181d 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h
@@ -18,11 +18,14 @@
  * limitations under the License.
  */
 
-#ifndef otbSinclairToReciprocalCircularCovarianceMatrixFunctor_h
-#define otbSinclairToReciprocalCircularCovarianceMatrixFunctor_h
+#ifndef otbSinclairToReciprocalCircularCovarianceMatrixImageFilter_h
+#define otbSinclairToReciprocalCircularCovarianceMatrixImageFilter_h
 
 #include <complex>
-#include "otbSinclairToReciprocalCovarianceMatrixFunctor.h"
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
+
+#include "otbFunctorImageFilter.h"
+#include "otbPolarimetryTags.h"
 
 namespace otb
 {
@@ -45,6 +48,8 @@ namespace Functor
  * The output pixel has 6 channels : the diagonal and the upper element of the reciprocal matrix.
  * Element are stored from left to right, line by line.
  *
+ * Use otb::SinclairToReciprocalCircularCovarianceMatrixImageFilter to apply it to an image.
+ *
  *  \ingroup Functor
  *  \ingroup SARPolarimetry
  *
@@ -69,7 +74,7 @@ public:
   typedef typename TOutput::ValueType              OutputValueType;
   typedef SinclairToReciprocalCovarianceMatrixFunctor<ComplexType, ComplexType, ComplexType, TOutput> SinclairToReciprocalCovarianceFunctorType;
 
-  inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv)
+  inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv) const
   {
     const ComplexType S_hh = static_cast<ComplexType>(Shh);
     const ComplexType S_hv = static_cast<ComplexType>(Shv);
@@ -96,15 +101,30 @@ public:
     // Size of the  matrix
     return 6;
   }
-
-  /** Constructor */
-  SinclairToReciprocalCircularCovarianceMatrixFunctor() {}
-
-  /** Destructor */
-  virtual ~SinclairToReciprocalCircularCovarianceMatrixFunctor() {}
 };
 
 } // namespace Functor
+  /**
+   * \typedef SinclairToReciprocalCircularCovarianceMatrixImageFilter
+   * \brief Applies otb::Functor::SinclairToReciprocalCircularCovarianceMatrixFunctor
+   * \sa otb::Functor::SinclairToReciprocalCircularCovarianceMatrixFunctor
+   *
+   * Set inputs with:
+   * \code
+   *
+   * SetVariadicNamedInput<polarimetry_tags::hh>(inputPtr);
+   * SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(inputPtr);
+   * SetVariadicNamedInput<polarimetry_tags::vv>(inputPtr);
+   *
+   * \endcode
+   *
+   * \ingroup OTBPolarimetry
+   */
+  template <typename TInputImage, typename TOutputImage>
+using SinclairToReciprocalCircularCovarianceMatrixImageFilter =
+    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>>;
 } // namespace otb
 
 #endif
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixImageFilter.h
similarity index 72%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixImageFilter.h
index 6aafde67d7..6af5e20268 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixImageFilter.h
@@ -18,14 +18,17 @@
  * limitations under the License.
  */
 
-#ifndef otbSinclairToReciprocalCoherencyMatrixFunctor_h
-#define otbSinclairToReciprocalCoherencyMatrixFunctor_h
+#ifndef otbSinclairToReciprocalCoherencyMatrixImageFilter_h
+#define otbSinclairToReciprocalCoherencyMatrixImageFilter_h
 
 #include "itkMacro.h"
 #include <complex>
 #include "otbMath.h"
 #include "vnl/vnl_matrix.h"
 
+#include "otbFunctorImageFilter.h"
+#include "otbPolarimetryTags.h"
+
 namespace otb
 {
 namespace Functor
@@ -47,6 +50,8 @@ namespace Functor
  * The output pixel has 6 channels : the diagonal and the upper element of the reciprocal matrix.
  * Element are stored from left to right, line by line.
  *
+ * Use otb::SinclairToReciprocalCoherencyMatrixImageFilter to apply it to an image.
+ *
  *  \ingroup Functor
  *  \ingroup SARPolarimetry
  *
@@ -70,19 +75,17 @@ public:
   typedef vnl_matrix<ComplexType>       		   VNLMatrixType;
   typedef typename TOutput::ValueType              OutputValueType;
 
-  inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv)
+  inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv) const
   {
     const ComplexType S_hh = static_cast<ComplexType>(Shh);
     const ComplexType S_hv = static_cast<ComplexType>(Shv);
     const ComplexType S_vv = static_cast<ComplexType>(Svv);
 
-
     VNLMatrixType f3p(3, 1, 0.);
     f3p[0][0]= (S_hh + S_vv) / ComplexType( std::sqrt(2.0) , 0.0);
     f3p[1][0]= (S_hh - S_vv) / ComplexType( std::sqrt(2.0) , 0.0);
     f3p[2][0]= ComplexType( std::sqrt(2.0) , 0.0) * S_hv;
 
-
     VNLMatrixType res = f3p*f3p.conjugate_transpose();
 
     result[0] = static_cast<OutputValueType>( res[0][0] );
@@ -98,15 +101,32 @@ public:
     // Size of the  matrix
     return 6;
   }
-
-  /** Constructor */
-  SinclairToReciprocalCoherencyMatrixFunctor() {}
-
-  /** Destructor */
-  virtual ~SinclairToReciprocalCoherencyMatrixFunctor() {}
 };
 
 } // namespace Functor
+
+  /**
+   * \typedef SinclairToReciprocalCoherencyMatrixImageFilter
+   * \brief Applies otb::Functor::SinclairToReciprocalCoherencyMatrixFunctor
+   * \sa otb::Functor::SinclairToReciprocalCoherencyMatrixFunctor
+   *
+   * Set inputs with:
+   * \code
+   *
+   * SetVariadicNamedInput<polarimetry_tags::hh>(inputPtr);
+   * SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(inputPtr);
+   * SetVariadicNamedInput<polarimetry_tags::vv>(inputPtr);
+   *
+   * \endcode
+   *
+   * \ingroup OTBPolarimetry
+   */
+  template <typename TInputImage, typename TOutputImage>
+  using SinclairToReciprocalCoherencyMatrixImageFilter =
+  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>>;
+
 } // namespace otb
 
 #endif
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixImageFilter.h
similarity index 70%
rename from Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
rename to Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixImageFilter.h
index d78e5158a3..9d07b83feb 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixImageFilter.h
@@ -18,13 +18,16 @@
  * limitations under the License.
  */
 
-#ifndef otbSinclairToReciprocalCovarianceMatrixFunctor_h
-#define otbSinclairToReciprocalCovarianceMatrixFunctor_h
+#ifndef otbSinclairToReciprocalCovarianceMatrixImageFilter_h
+#define otbSinclairToReciprocalCovarianceMatrixImageFilter_h
 
 #include <complex>
 #include "otbMath.h"
 #include "vnl/vnl_matrix.h"
 
+#include "otbFunctorImageFilter.h"
+#include "otbPolarimetryTags.h"
+
 namespace otb
 {
 namespace Functor
@@ -46,6 +49,8 @@ namespace Functor
  * The output pixel has 6 channels : the diagonal and the upper element of the reciprocal matrix.
  * Element are stored from left to right, line by line.
  *
+ * Use otb::SinclairToReciprocalCovarianceMatrixImageFilter to apply it to an image.
+ *
  *  \ingroup Functor
  *  \ingroup SARPolarimetry
  *
@@ -68,7 +73,7 @@ public:
   typedef typename std::complex <double>           ComplexType;
   typedef vnl_matrix<ComplexType>       		   VNLMatrixType;
   typedef typename TOutput::ValueType              OutputValueType;
-  inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv)
+  inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv) const
   {
     const ComplexType S_hh = static_cast<ComplexType>(Shh);
     const ComplexType S_hv = static_cast<ComplexType>(Shv);
@@ -94,15 +99,31 @@ public:
     // Size of the  matrix
     return 6;
   }
-
-  /** Constructor */
-  SinclairToReciprocalCovarianceMatrixFunctor() {}
-
-  /** Destructor */
-  virtual ~SinclairToReciprocalCovarianceMatrixFunctor() {}
 };
 
 } // namespace Functor
+
+/**
+   * \typedef SinclairToReciprocalCovarianceMatrixImageFilter
+   * \brief Applies otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor
+   * \sa otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor
+   *
+   * Set inputs with:
+   * \code
+   *
+   * SetVariadicNamedInput<polarimetry_tags::hh>(inputPtr);
+   * SetVariadicNamedInput<polarimetry_tags::hv_or_vh>(inputPtr);
+   * SetVariadicNamedInput<polarimetry_tags::vv>(inputPtr);
+   *
+   * \endcode
+   *
+   * \ingroup OTBPolarimetry
+   */
+template <typename TInputImage, typename TOutputImage>
+using SinclairToReciprocalCovarianceMatrixImageFilter =
+    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>>;
 } // namespace otb
 
 #endif
diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx
index eb89e51ef1..dc49123d8c 100644
--- a/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbReciprocalBarnesDecomp.cxx
@@ -30,7 +30,7 @@
 #include "otbPerBandVectorImageFilter.h"
 
 #include "otbPolarimetricFilters.h"
-
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
 
 int otbReciprocalBarnesDecompImageFilter(int itkNotUsed(argc), char * argv[])
 {
@@ -52,7 +52,7 @@ int otbReciprocalBarnesDecompImageFilter(int itkNotUsed(argc), char * argv[])
   typedef otb::ImageFileReader<ComplexImageType>  ReaderType;
   typedef otb::ImageFileWriter<ComplexVectorImageType> WriterType;
 
-  using SinclairToCovFilterType = otb::SinclairToReciprocalCovarianceMatrixFilter<ComplexImageType, ComplexVectorImageType>;
+  using SinclairToCovFilterType = otb::SinclairToReciprocalCovarianceMatrixImageFilter<ComplexImageType, ComplexVectorImageType>;
 
   typedef itk::MeanImageFilter<ComplexImageType, ComplexImageType>         MeanFilterType;
   typedef otb::PerBandVectorImageFilter<ComplexVectorImageType, ComplexVectorImageType, MeanFilterType> PerBandMeanFilterType;
diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx
index 269d8df48f..20a7f010b0 100644
--- a/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx
@@ -30,6 +30,7 @@
 #include "otbPerBandVectorImageFilter.h"
 
 #include "otbPolarimetricFilters.h"
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
 
 int otbReciprocalHAlphaImageFilter(int itkNotUsed(argc), char * argv[])
 {
@@ -53,7 +54,7 @@ int otbReciprocalHAlphaImageFilter(int itkNotUsed(argc), char * argv[])
   typedef otb::ImageFileReader<ComplexImageType>  ReaderType;
   typedef otb::ImageFileWriter<RealVectorImageType> WriterType;
 
-  using SinclairToCovFilterType = otb::SinclairToReciprocalCovarianceMatrixFilter<ComplexImageType, ComplexVectorImageType>;
+  using SinclairToCovFilterType = otb::SinclairToReciprocalCovarianceMatrixImageFilter<ComplexImageType, ComplexVectorImageType>;
 
   typedef itk::MeanImageFilter<ComplexImageType, ComplexImageType>         MeanFilterType;
   typedef otb::PerBandVectorImageFilter<ComplexVectorImageType, ComplexVectorImageType, MeanFilterType> PerBandMeanFilterType;
diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx
index 0900809510..7cda10f024 100644
--- a/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbReciprocalHuynenDecomp.cxx
@@ -31,6 +31,7 @@
 #include "otbPerBandVectorImageFilter.h"
 
 #include "otbPolarimetricFilters.h"
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
 
 int otbReciprocalHuynenDecompImageFilter(int itkNotUsed(argc), char * argv[])
 {
@@ -52,7 +53,7 @@ int otbReciprocalHuynenDecompImageFilter(int itkNotUsed(argc), char * argv[])
   typedef otb::ImageFileReader<ComplexImageType>  ReaderType;
   typedef otb::ImageFileWriter<ComplexVectorImageType> WriterType;
 
-  using SinclairToCovFilterType = otb::SinclairToReciprocalCovarianceMatrixFilter<ComplexImageType, ComplexVectorImageType>;
+  using SinclairToCovFilterType = otb::SinclairToReciprocalCovarianceMatrixImageFilter<ComplexImageType, ComplexVectorImageType>;
 
   typedef itk::MeanImageFilter<ComplexImageType, ComplexImageType>         MeanFilterType;
   typedef otb::PerBandVectorImageFilter<ComplexVectorImageType, ComplexVectorImageType, MeanFilterType> PerBandMeanFilterType;
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairImageFilter.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairImageFilter.cxx
index 330bfd09ed..0b6dc50ec6 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairImageFilter.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairImageFilter.cxx
@@ -26,7 +26,12 @@
 #include "otbImage.h"
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
-#include "otbPolarimetricFilters.h"
+
+#include "otbSinclairToCoherencyMatrixImageFilter.h"
+#include "otbSinclairToCovarianceMatrixImageFilter.h"
+#include "otbSinclairToCircularCovarianceMatrixImageFilter.h"
+#include "otbSinclairToMuellerMatrixImageFilter.h"
+
 #include "otbMultiChannelExtractROI.h"
 
 
@@ -92,10 +97,10 @@ int otbSinclairImageFilter(int argc, char * argv[])
   typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType;
   typedef otb::VectorImage<OutputRealPixelType, Dimension> OutputRealImageType;
 
-  using CohSRFilterType = SinclairToCoherencyMatrixFilter<InputImageType, OutputImageType>;
-  using CovSRFilterType = SinclairToCovarianceMatrixFilter<InputImageType, OutputImageType>;
-  using CCSRFilterType  = SinclairToCircularCovarianceMatrixFilter<InputImageType,OutputImageType>;
-  using MSRFilterType   = SinclairToMuellerMatrixFilter<InputImageType,OutputRealImageType>;
+  using CohSRFilterType = SinclairToCoherencyMatrixImageFilter<InputImageType, OutputImageType>;
+  using CovSRFilterType = SinclairToCovarianceMatrixImageFilter<InputImageType, OutputImageType>;
+  using CCSRFilterType  = SinclairToCircularCovarianceMatrixImageFilter<InputImageType,OutputImageType>;
+  using MSRFilterType   = SinclairToMuellerMatrixImageFilter<InputImageType,OutputRealImageType>;
 
 
   std::string strArgv(argv[1]);
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairReciprocalImageFilter.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairReciprocalImageFilter.cxx
index ac50381884..d2c2d54148 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairReciprocalImageFilter.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairReciprocalImageFilter.cxx
@@ -29,6 +29,10 @@
 
 #include "otbMultiChannelExtractROI.h"
 
+#include "otbSinclairToReciprocalCoherencyMatrixImageFilter.h"
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
+#include "otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h"
+
 using namespace otb;
 
 template<class TFilter>
@@ -89,9 +93,9 @@ int otbSinclairReciprocalImageFilter(int argc, char * argv[])
   typedef otb::Image<InputPixelType,  Dimension>       InputImageType;
   typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType;
 
-  using SToRecCohFilterType = SinclairToReciprocalCoherencyMatrixFilter<InputImageType, OutputImageType>;
-  using SToRecCovFilterType = SinclairToReciprocalCovarianceMatrixFilter<InputImageType, OutputImageType>;
-  using SToRecCircCovFilterType = SinclairToReciprocalCircularCovarianceMatrixFilter<InputImageType, OutputImageType>;
+  using SToRecCohFilterType = SinclairToReciprocalCoherencyMatrixImageFilter<InputImageType, OutputImageType>;
+  using SToRecCovFilterType = SinclairToReciprocalCovarianceMatrixImageFilter<InputImageType, OutputImageType>;
+  using SToRecCircCovFilterType = SinclairToReciprocalCircularCovarianceMatrixImageFilter<InputImageType, OutputImageType>;
 
   std::string strArgv(argv[1]);
   argc--;
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx
index 097c6de39d..926d3f022f 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx
@@ -19,7 +19,7 @@
  */
 
 
-#include "otbSinclairToCircularCovarianceMatrixFunctor.h"
+#include "otbSinclairToCircularCovarianceMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToCircularCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToCoherencyMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToCoherencyMatrixFunctor.cxx
index a3f1b38fef..3c7131a00b 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToCoherencyMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToCoherencyMatrixFunctor.cxx
@@ -19,7 +19,7 @@
  */
 
 
-#include "otbSinclairToCoherencyMatrixFunctor.h"
+#include "otbSinclairToCoherencyMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToCoherencyMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToCovarianceMatrixFunctor.cxx
index e83f250c1b..cc4248a550 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToCovarianceMatrixFunctor.cxx
@@ -20,7 +20,7 @@
 
 #include "itkMacro.h"
 
-#include "otbSinclairToCovarianceMatrixFunctor.h"
+#include "otbSinclairToCovarianceMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToMuellerMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToMuellerMatrixFunctor.cxx
index 6737094abd..688597c070 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToMuellerMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToMuellerMatrixFunctor.cxx
@@ -20,7 +20,7 @@
 
 #include "itkMacro.h"
 
-#include "otbSinclairToMuellerMatrixFunctor.h"
+#include "otbSinclairToMuellerMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToMuellerMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx
index 77b557682e..081b049f5f 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx
@@ -19,7 +19,7 @@
  */
 
 
-#include "otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h"
+#include "otbSinclairToReciprocalCircularCovarianceMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToReciprocalCircularCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx
index 7c7d193947..9e7f4edf8c 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx
@@ -20,7 +20,7 @@
 
 #include "itkMacro.h"
 
-#include "otbSinclairToReciprocalCoherencyMatrixFunctor.h"
+#include "otbSinclairToReciprocalCoherencyMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToReciprocalCoherencyMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx
index 32a3d1a3c6..b7bbe1507e 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx
@@ -20,7 +20,7 @@
 
 #include "itkMacro.h"
 
-#include "otbSinclairToReciprocalCovarianceMatrixFunctor.h"
+#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
 #include "itkVariableLengthVector.h"
 
 int otbSinclairToReciprocalCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
-- 
GitLab