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 @@
#include "otbMuellerToReciprocalCovarianceImageFilter.h"
#include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h"
#include "otbSinclairImageFilters.h"
namespace otb
......@@ -121,11 +119,6 @@ public:
ComplexDoubleVectorImageType::PixelType> CoherencyFunctorType;
typedef otb::Functor::SinclairToCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleVectorImageType::PixelType> CovarianceFunctorType;
typedef otb::Functor::SinclairToCircularCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
......@@ -150,12 +143,8 @@ public:
CoherencyFunctorType > CohSRFilterType;
typedef SinclairImageFilter<ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleVectorImageType,
CovarianceFunctorType > CovSRFilterType;
using CovSRFilterType = SinclairToCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
typedef SinclairImageFilter<ComplexDoubleImageType,
ComplexDoubleImageType,
......@@ -625,10 +614,10 @@ private:
m_CovSRFilter = CovSRFilterType::New();
m_CovSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
m_CovSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv"));
m_CovSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh"));
m_CovSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
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_CovSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels
......
......@@ -27,14 +27,12 @@
namespace otb
{
// This is the entire declaration of SinclairToCovarianceMatrixFilter
// This is the entire declaration of SinclairToCovarianceMatrixFilter
template <typename TInputImage, typename TOutputImage>
using SinclairToCovarianceMatrixFilter = FunctorImageFilter< Functor::SinclairToCovarianceMatrixFunctor <typename TInputImage::PixelType,typename TInputImage::PixelType,typename TInputImage::PixelType,typename TInputImage::PixelType,
typename TOutputImage::PixelType> ,
std::tuple<polarimetry_tags::hh,
polarimetry_tags::hv,
polarimetry_tags::vh,
polarimetry_tags::vv> >;
using SinclairToCovarianceMatrixFilter = DefaultConstructibleFunctorImageFilter<
Functor::SinclairToCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType,
typename TInputImage::PixelType, typename TOutputImage::PixelType>,
std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>;
} // end namespace otb
......
......@@ -71,9 +71,7 @@ public:
inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv,
const TInput3& Svh, const TInput4& Svv)
{
TOutput result;
result.SetSize(m_NumberOfComponentsPerPixel);
TOutput result(10);
const ComplexType S_hh = static_cast<ComplexType>(Shh);
const ComplexType S_hv = static_cast<ComplexType>(Shv);
......@@ -90,28 +88,23 @@ public:
result[7] = static_cast<OutputValueType>( std::norm(S_vh) );
result[8] = static_cast<OutputValueType>( S_vh*std::conj(S_vv) );
result[9] = static_cast<OutputValueType>( std::norm(S_vv) );
return (result);
return result;
}
unsigned int GetNumberOfComponentsPerPixel()
constexpr size_t GetNumberOfComponentsPerPixel()
{
return m_NumberOfComponentsPerPixel;
return OutputSize();
}
constexpr size_t OutputSize(...) const
{
// Number of components in the covariance matrix
return 10;
}
/** Constructor */
SinclairToCovarianceMatrixFunctor() {}
/** Destructor */
virtual ~SinclairToCovarianceMatrixFunctor() {}
protected:
private:
//itkStaticConstMacro(m_NumberOfComponentsPerPixel, unsigned int, 10);
static const unsigned int m_NumberOfComponentsPerPixel = 10;
};
} // 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