diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h index cc9c9fe283d10b4b3bf24a1f4e93157cb0209f36..54b09452370b7515fae6bd17076965ed62a61785 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h @@ -79,17 +79,14 @@ public: typedef std::complex <RealType> ComplexType; typedef typename TOutput::ValueType OutputValueType; typedef SinclairToCovarianceMatrixFunctor<ComplexType, ComplexType, ComplexType, ComplexType, TOutput> SinclairToCovarianceFunctorType; - inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv, + inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svh, const TInput4& Svv) { - TOutput result; - const ComplexType S_hh = static_cast<ComplexType>(Shh); const ComplexType S_hv = static_cast<ComplexType>(Shv); const ComplexType S_vh = static_cast<ComplexType>(Svh); const ComplexType S_vv = static_cast<ComplexType>(Svv); - result.SetSize(m_NumberOfComponentsPerPixel); const ComplexType jS_hv = S_hv * ComplexType(0., 1.); const ComplexType jS_vh = S_vh * ComplexType(0., 1.); const ComplexType jS_hh = S_hh * ComplexType(0., 1.); @@ -102,31 +99,21 @@ public: const ComplexType Srl = coef*( jS_hh-S_hv+S_vh+jS_vv ); const ComplexType Srr = coef*( -S_hh+jS_hv+jS_vh+S_vv ); - //const ComplexType conjSll = std::conj(Sll); - //const ComplexType conjSlr = std::conj(Slr); - //const ComplexType conjSrl = std::conj(Srl); - //const ComplexType conjSrr = std::conj(Srr); - SinclairToCovarianceFunctorType funct; return ( funct( Sll, Slr, Srl, Srr ) ); } - unsigned int GetNumberOfComponentsPerPixel() + constexpr size_t OutputSize(...) const { - return m_NumberOfComponentsPerPixel; + // Size of circular covariance matrix + return 10; } /** Constructor */ - SinclairToCircularCovarianceMatrixFunctor() : m_NumberOfComponentsPerPixel(10) {} + SinclairToCircularCovarianceMatrixFunctor() {} /** Destructor */ virtual ~SinclairToCircularCovarianceMatrixFunctor() {} - -protected: - - -private: - unsigned int m_NumberOfComponentsPerPixel; }; } // namespace Functor diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h index 1e845bc46d334a17bb7f2147d1c968b3920e6413..6b6e75bb5307ff2cfbdfae8575e0170b27e1ff1f 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h @@ -69,11 +69,9 @@ public: typedef double RealType; typedef std::complex <RealType> ComplexType; typedef typename TOutput::ValueType OutputValueType; - inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv, + inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svh, const TInput4& Svv) { - TOutput result(10); - const ComplexType S_hh = static_cast<ComplexType>(Shh); const ComplexType S_hv = static_cast<ComplexType>(Shv); const ComplexType S_vh = static_cast<ComplexType>(Svh); @@ -106,11 +104,6 @@ public: return 10; } - constexpr size_t GetNumberOfComponentsPerPixel() - { - return OutputSize(); - } - /** Constructor */ SinclairToCoherencyMatrixFunctor() {} diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h index 37d9624f5f07058ca9728445acaca72d578a605c..47f3ea3dfd5db4979480d05e751f5cd4da14531c 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h @@ -68,11 +68,9 @@ public: /** Some typedefs. */ typedef typename std::complex <double> ComplexType; typedef typename TOutput::ValueType OutputValueType; - inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv, + inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svh, const TInput4& Svv) { - TOutput result(10); - const ComplexType S_hh = static_cast<ComplexType>(Shh); const ComplexType S_hv = static_cast<ComplexType>(Shv); const ComplexType S_vh = static_cast<ComplexType>(Svh); @@ -91,10 +89,7 @@ public: return result; } - constexpr size_t GetNumberOfComponentsPerPixel() - { - return OutputSize(); - } + constexpr size_t OutputSize(...) const { // Number of components in the covariance matrix diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h index 500a06769dec68521bbadfe6970cd2d391137f71..fc21f3003206b02ac8d3bf36f459fe4b7c55c821 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h @@ -89,11 +89,9 @@ public: typedef typename TOutput::ValueType OutputValueType; typedef double RealType; - inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv, + inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svh, const TInput4& Svv) { - TOutput result(16); - const ComplexType Txx = static_cast<ComplexType>(-Shh); const ComplexType Txy = static_cast<ComplexType>(-Shv); const ComplexType Tyx = static_cast<ComplexType>(Svh); @@ -130,11 +128,6 @@ public: return 16; } - constexpr size_t GetNumberOfComponentsPerPixel() - { - return OutputSize(); - } - /** Constructor */ SinclairToMuellerMatrixFunctor() {}