Skip to content
Snippets Groups Projects
Commit 446a80a8 authored by Victor Poughon's avatar Victor Poughon
Browse files

WIP: begin refactor sinclair image filters

parent de3f6c75
No related branches found
No related tags found
No related merge requests found
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
#include "otbMuellerToReciprocalCovarianceImageFilter.h" #include "otbMuellerToReciprocalCovarianceImageFilter.h"
#include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h" #include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h"
#include "otbSinclairImageFilters.h"
namespace otb namespace otb
...@@ -121,11 +119,6 @@ public: ...@@ -121,11 +119,6 @@ public:
ComplexDoubleVectorImageType::PixelType> CoherencyFunctorType; ComplexDoubleVectorImageType::PixelType> CoherencyFunctorType;
typedef otb::Functor::SinclairToCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleVectorImageType::PixelType> CovarianceFunctorType;
typedef otb::Functor::SinclairToCircularCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType, typedef otb::Functor::SinclairToCircularCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
...@@ -150,12 +143,8 @@ public: ...@@ -150,12 +143,8 @@ public:
CoherencyFunctorType > CohSRFilterType; CoherencyFunctorType > CohSRFilterType;
typedef SinclairImageFilter<ComplexDoubleImageType, using CovSRFilterType = SinclairToCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleVectorImageType,
CovarianceFunctorType > CovSRFilterType;
typedef SinclairImageFilter<ComplexDoubleImageType, typedef SinclairImageFilter<ComplexDoubleImageType,
ComplexDoubleImageType, ComplexDoubleImageType,
...@@ -625,10 +614,10 @@ private: ...@@ -625,10 +614,10 @@ private:
m_CovSRFilter = CovSRFilterType::New(); m_CovSRFilter = CovSRFilterType::New();
m_CovSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_CovSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
m_CovSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
m_CovSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
SetParameterOutputImage("outc", m_CovSRFilter->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
......
...@@ -27,14 +27,12 @@ ...@@ -27,14 +27,12 @@
namespace otb namespace otb
{ {
// This is the entire declaration of SinclairToCovarianceMatrixFilter // This is the entire declaration of SinclairToCovarianceMatrixFilter
template <typename TInputImage, typename TOutputImage> template <typename TInputImage, typename TOutputImage>
using SinclairToCovarianceMatrixFilter = FunctorImageFilter< Functor::SinclairToCovarianceMatrixFunctor <typename TInputImage::PixelType,typename TInputImage::PixelType,typename TInputImage::PixelType,typename TInputImage::PixelType, using SinclairToCovarianceMatrixFilter = DefaultConstructibleFunctorImageFilter<
typename TOutputImage::PixelType> , Functor::SinclairToCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType,
std::tuple<polarimetry_tags::hh, typename TInputImage::PixelType, typename TOutputImage::PixelType>,
polarimetry_tags::hv, std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>;
polarimetry_tags::vh,
polarimetry_tags::vv> >;
} // end namespace otb } // end namespace otb
......
...@@ -71,9 +71,7 @@ public: ...@@ -71,9 +71,7 @@ public:
inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv, inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv,
const TInput3& Svh, const TInput4& Svv) const TInput3& Svh, const TInput4& Svv)
{ {
TOutput result; TOutput result(10);
result.SetSize(m_NumberOfComponentsPerPixel);
const ComplexType S_hh = static_cast<ComplexType>(Shh); const ComplexType S_hh = static_cast<ComplexType>(Shh);
const ComplexType S_hv = static_cast<ComplexType>(Shv); const ComplexType S_hv = static_cast<ComplexType>(Shv);
...@@ -90,28 +88,23 @@ public: ...@@ -90,28 +88,23 @@ public:
result[7] = static_cast<OutputValueType>( std::norm(S_vh) ); result[7] = static_cast<OutputValueType>( std::norm(S_vh) );
result[8] = static_cast<OutputValueType>( S_vh*std::conj(S_vv) ); result[8] = static_cast<OutputValueType>( S_vh*std::conj(S_vv) );
result[9] = static_cast<OutputValueType>( std::norm(S_vv) ); result[9] = static_cast<OutputValueType>( std::norm(S_vv) );
return (result); return result;
} }
constexpr size_t GetNumberOfComponentsPerPixel()
unsigned int GetNumberOfComponentsPerPixel()
{ {
return m_NumberOfComponentsPerPixel; return OutputSize();
}
constexpr size_t OutputSize(...) const
{
// Number of components in the covariance matrix
return 10;
} }
/** Constructor */ /** Constructor */
SinclairToCovarianceMatrixFunctor() {} SinclairToCovarianceMatrixFunctor() {}
/** Destructor */ /** Destructor */
virtual ~SinclairToCovarianceMatrixFunctor() {} virtual ~SinclairToCovarianceMatrixFunctor() {}
protected:
private:
//itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 10);
static const unsigned int m_NumberOfComponentsPerPixel = 10;
}; };
} // namespace Functor } // namespace Functor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment