From d0e09b5860e82937e4d7b5a1ed6db302e793b260 Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@cnes.fr>
Date: Thu, 13 Dec 2018 17:31:49 +0100
Subject: [PATCH] ENH: remove GetOutputSize method and
 NumberOfComponentsPerPixel attribute from polar functors

---
 ...otbMuellerToPolarisationDegreeAndPowerFunctor.h |  8 +-------
 .../include/otbReciprocalBarnesDecompFunctor.h     | 11 ++---------
 .../include/otbReciprocalHAlphaImageFunctor.h      |  6 ++----
 .../include/otbReciprocalHuynenDecompFunctor.h     | 10 ++--------
 .../include/otbReciprocalPauliDecompFunctor.h      | 14 ++++----------
 ...irToReciprocalCircularCovarianceMatrixFunctor.h | 13 +------------
 ...otbSinclairToReciprocalCoherencyMatrixFunctor.h | 12 ------------
 ...tbSinclairToReciprocalCovarianceMatrixFunctor.h | 13 -------------
 8 files changed, 12 insertions(+), 75 deletions(-)

diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerFunctor.h b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerFunctor.h
index 8a58cd100c..01abfc2e99 100644
--- a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerFunctor.h
@@ -170,11 +170,6 @@ public:
     result[3] = l_PolarisationDegreeMax;
     }
 
-  unsigned int GetOutputSize()
-  {
-    return m_NumberOfComponentsPerPixel;
-  }
-
   constexpr size_t OutputSize(...) const
   {
     // Size of the result
@@ -182,13 +177,12 @@ public:
   }
 
    /** Constructor */
-   MuellerToPolarisationDegreeAndPowerFunctor() : m_NumberOfComponentsPerPixel(4), m_Epsilon(1e-6), m_PI_90(2*CONST_PI_180) {}
+   MuellerToPolarisationDegreeAndPowerFunctor() : m_Epsilon(1e-6), m_PI_90(2*CONST_PI_180) {}
 
    /** Destructor */
    virtual ~MuellerToPolarisationDegreeAndPowerFunctor() {}
 
 private:
-    unsigned int m_NumberOfComponentsPerPixel;
     const double m_Epsilon;
     const double m_PI_90;
 };
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h
index c0cc0e3b40..ecf39c1de6 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompFunctor.h
@@ -19,10 +19,9 @@
  */
 
 
-#ifndef otbReciprocalBarnesDecompImageFilter_h
-#define otbReciprocalBarnesDecompImageFilter_h
+#ifndef otbReciprocalBarnesDecompFunctor_h
+#define otbReciprocalBarnesDecompFunctor_h
 
-#include "otbUnaryFunctorImageFilter.h"
 #include "otbMath.h"
 #include "vnl/algo/vnl_complex_eigensystem.h"
 #include <algorithm>
@@ -97,11 +96,6 @@ public:
     result[8] = static_cast<OutputValueType>(ki[2][0]);
   }
 
-   unsigned int GetOutputSize()
-   {
-     return m_NumberOfComponentsPerPixel;
-   }
-
   constexpr size_t OutputSize(...) const
   {
     // Size of the result
@@ -115,7 +109,6 @@ public:
    virtual ~ReciprocalBarnesDecompFunctor() {}
 
 private:
-   itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 9);
    const double m_Epsilon;
 };
 } // end namespace functor
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h
index 8a146f4324..58fcdf379b 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFunctor.h
@@ -19,10 +19,9 @@
  */
 
 
-#ifndef otbReciprocalHAlphaImageFilter_h
-#define otbReciprocalHAlphaImageFilter_h
+#ifndef otbReciprocalHAlphaFunctor_h
+#define otbReciprocalHAlphaFunctor_h
 
-#include "otbUnaryFunctorImageFilter.h"
 #include "otbMath.h"
 #include "vnl/algo/vnl_complex_eigensystem.h"
 #include <algorithm>
@@ -177,7 +176,6 @@ public:
    virtual ~ReciprocalHAlphaFunctor() {}
 
 private:
-   itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 3);
    static constexpr double m_Epsilon = 1e-6;
 };
 } // end namespace functor
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h
index 4ab534e451..3d019b201b 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompFunctor.h
@@ -19,8 +19,8 @@
  */
 
 
-#ifndef otbReciprocalHuynenDecompImageFilter_h
-#define otbReciprocalHuynenDecompImageFilter_h
+#ifndef otbReciprocalHuynenDecompFunctor_h
+#define otbReciprocalHuynenDecompFunctor_h
 
 namespace otb
  {
@@ -64,11 +64,6 @@ public:
     result[8] = H;
     }
 
-   unsigned int GetOutputSize()
-   {
-     return m_NumberOfComponentsPerPixel;
-   }
-
    constexpr size_t OutputSize(...) const
   {
     // Size of the result
@@ -82,7 +77,6 @@ public:
    virtual ~ReciprocalHuynenDecompFunctor() {}
 
 private:
-   itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 9);
    const double m_Epsilon;
 };
 } // end namespace functor
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h
index ce7019fb17..6162fca9a0 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompFunctor.h
@@ -19,8 +19,8 @@
  */
 
 
-#ifndef otbReciprocalPauliDecompImageFilter_h
-#define otbReciprocalPauliDecompImageFilter_h
+#ifndef otbReciprocalPauliDecompFunctor_h
+#define otbReciprocalPauliDecompFunctor_h
 
 namespace otb
  {
@@ -55,11 +55,6 @@ public:
     result[2] = sqrt2*Shv;
     }
 
-   unsigned int GetOutputSize()
-   {
-     return m_NumberOfComponentsPerPixel;
-   }
-
    constexpr size_t OutputSize(...) const
   {
     // Size of the result
@@ -67,14 +62,13 @@ public:
   }
 
    /** Constructor */
-   ReciprocalPauliDecompFunctor() : m_Epsilon(1e-6) {}
+   ReciprocalPauliDecompFunctor() : {}
 
    /** Destructor */
    virtual ~ReciprocalPauliDecompFunctor() {}
 
 private:
-   itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 3);
-   const double m_Epsilon;
+   static constexpr double m_Epsilon = 1e-6;
 };
 } // end namespace functor
 } // end namespace otb
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
index 85e33689c0..7a517f9be0 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
@@ -91,11 +91,6 @@ public:
     funct(result, Sll, Slr, Srr);
   }
 
-  unsigned int GetNumberOfComponentsPerPixel()
-  {
-    return m_NumberOfComponentsPerPixel;
-  }
-
   constexpr size_t OutputSize(...) const
   {
     // Size of the  matrix
@@ -103,16 +98,10 @@ public:
   }
 
   /** Constructor */
-  SinclairToReciprocalCircularCovarianceMatrixFunctor() : m_NumberOfComponentsPerPixel(6) {}
+  SinclairToReciprocalCircularCovarianceMatrixFunctor() : {}
 
   /** Destructor */
   virtual ~SinclairToReciprocalCircularCovarianceMatrixFunctor() {}
-
-protected:
-
-
-private:
-    unsigned int m_NumberOfComponentsPerPixel;
 };
 
 } // namespace Functor
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
index dd61ee5c4b..6aafde67d7 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
@@ -70,8 +70,6 @@ public:
   typedef vnl_matrix<ComplexType>       		   VNLMatrixType;
   typedef typename TOutput::ValueType              OutputValueType;
 
-  itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 6);
-
   inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv)
   {
     const ComplexType S_hh = static_cast<ComplexType>(Shh);
@@ -95,11 +93,6 @@ public:
     result[5] = static_cast<OutputValueType>( res[2][2] );
   }
 
-  unsigned int GetNumberOfComponentsPerPixel()
-  {
-    return NumberOfComponentsPerPixel;
-  }
-
   constexpr size_t OutputSize(...) const
   {
     // Size of the  matrix
@@ -111,11 +104,6 @@ public:
 
   /** Destructor */
   virtual ~SinclairToReciprocalCoherencyMatrixFunctor() {}
-
-protected:
-
-private:
-
 };
 
 } // namespace Functor
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
index 2e7275a5f5..d78e5158a3 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
@@ -89,11 +89,6 @@ public:
     result[5] = static_cast<OutputValueType>( res[2][2] );
   }
 
-  unsigned int GetNumberOfComponentsPerPixel()
-  {
-    return NumberOfComponentsPerPixel;
-  }
-
   constexpr size_t OutputSize(...) const
   {
     // Size of the  matrix
@@ -105,14 +100,6 @@ public:
 
   /** Destructor */
   virtual ~SinclairToReciprocalCovarianceMatrixFunctor() {}
-
-protected:
-
-
-private:
-  //itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 6);
-  static const unsigned int NumberOfComponentsPerPixel = 6;
-
 };
 
 } // namespace Functor
-- 
GitLab