Skip to content
Snippets Groups Projects
Commit 4a8b1889 authored by Julien Michel's avatar Julien Michel
Browse files

REFAC: Remove completely SinclairImageFilter, and replace by FunctorImageFilter

parent 1d8aa4e2
No related branches found
No related tags found
No related merge requests found
...@@ -111,55 +111,13 @@ public: ...@@ -111,55 +111,13 @@ public:
typedef otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RLCRCCFilterType; typedef otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RLCRCCFilterType;
//Bistatic case //Bistatic case
typedef otb::Functor::SinclairToCoherencyMatrixFunctor<ComplexDoubleImageType::PixelType, using CohSRFilterType = SinclairToCoherencyMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
ComplexDoubleImageType::PixelType, using CovSRFilterType = SinclairToCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
ComplexDoubleImageType::PixelType, using CCSRFilterType = SinclairToCircularCovarianceMatrixFilter<ComplexDoubleImageType,ComplexDoubleVectorImageType>;
ComplexDoubleImageType::PixelType, using MSRFilterType = SinclairToMuellerMatrixFilter<ComplexDoubleImageType,DoubleVectorImageType>;
ComplexDoubleVectorImageType::PixelType> CoherencyFunctorType;
typedef otb::Functor::SinclairToCircularCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleVectorImageType::PixelType> CircularCovarianceFunctorType;
typedef otb::Functor::SinclairToMuellerMatrixFunctor<ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
ComplexDoubleImageType::PixelType,
DoubleVectorImageType::PixelType> MuellerFunctorType;
typedef SinclairImageFilter<ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleVectorImageType,
CoherencyFunctorType > CohSRFilterType;
using CovSRFilterType = SinclairToCovarianceMatrixFilter<ComplexDoubleImageType, ComplexDoubleVectorImageType>;
typedef SinclairImageFilter<ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleVectorImageType,
CircularCovarianceFunctorType > CCSRFilterType;
typedef SinclairImageFilter<ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
ComplexDoubleImageType,
DoubleVectorImageType,
MuellerFunctorType > MSRFilterType;
typedef otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType> MRCFilterType; typedef otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType> MRCFilterType;
...@@ -598,11 +556,10 @@ private: ...@@ -598,11 +556,10 @@ private:
case 8: // SinclairToCoherency case 8: // SinclairToCoherency
m_CohSRFilter = CohSRFilterType::New(); m_CohSRFilter = CohSRFilterType::New();
m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_CohSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
m_CohSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv")); m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
m_CohSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_CohSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
m_CohSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
SetParameterOutputImage("outc", m_CohSRFilter->GetOutput() ); // input : 4 x 1 complex channel | 10 complex channels SetParameterOutputImage("outc", m_CohSRFilter->GetOutput() ); // input : 4 x 1 complex channel | 10 complex channels
...@@ -613,7 +570,6 @@ private: ...@@ -613,7 +570,6 @@ private:
case 9: // SinclairToCovariance case 9: // SinclairToCovariance
m_CovSRFilter = CovSRFilterType::New(); m_CovSRFilter = CovSRFilterType::New();
m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh")); m_CovSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
...@@ -627,11 +583,10 @@ private: ...@@ -627,11 +583,10 @@ private:
case 10: // SinclairToCircularCovariance case 10: // SinclairToCircularCovariance
m_CCSRFilter = CCSRFilterType::New(); m_CCSRFilter = CCSRFilterType::New();
m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_CCSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
m_CCSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv")); m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
m_CCSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_CCSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
m_CCSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
SetParameterOutputImage("outc", m_CCSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels SetParameterOutputImage("outc", m_CCSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels
...@@ -646,10 +601,10 @@ private: ...@@ -646,10 +601,10 @@ private:
case 11: // SinclairToMueller case 11: // SinclairToMueller
m_MSRFilter = MSRFilterType::New(); m_MSRFilter = MSRFilterType::New();
m_MSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hh>(GetParameterComplexDoubleImage("inhh"));
m_MSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv")); m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::hv>(GetParameterComplexDoubleImage("inhv"));
m_MSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vh>(GetParameterComplexDoubleImage("invh"));
m_MSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); m_MSRFilter->SetVariadicNamedInput<polarimetry_tags::vv>(GetParameterComplexDoubleImage("invv"));
SetParameterOutputImage("outf", m_MSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 16 real channels SetParameterOutputImage("outf", m_MSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 16 real channels
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbSinclairImageFilter_h
#define otbSinclairImageFilter_h
#include "otbQuaternaryFunctorImageFilter.h"
#include "otbSinclairToCovarianceMatrixFunctor.h"
#include <complex>
namespace otb
{
/** \class SinclairImageFilter
* \brief Computes the Covariance matrix for the sinclair one.
*
* This class is parameterized over the type of the input images and
* the type of the output image. It is also parameterized by the
* operation to be applied, using a Functor style.
*
* The output image has 10 channels : the diagonal and the upper element of the matrix.
* Element are stored from left to right, line by line.
*
* The class is templated by the 4 input image (HH, HV, VH and VV) and the used functor.
* Available functors are :
* - SinclairToCircularCovarianceMatrixFunctor (default one)
* - SinclairToCoherencyMatrixFunctor
* - SinclairToCovarianceMatrixFunctor
* - SinclairToMuelleMatrixrFunctor
*
* \ingroup SARPolarimetry
*
* \sa SinclairImageFilter
* \sa SinclairToCircularCovarianceMatrixFunctor
* \sa SinclairToCoherencyMatrixFunctor
* \sa SinclairToCovarianceMatrixFunctor
* \sa SinclairToMuelleMatrixrFunctor
*
*
* \ingroup OTBPolarimetry
*/
template <class TInputImageHH, class TInputImageHV,
class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction = Functor::SinclairToCovarianceMatrixFunctor<
typename TInputImageHH::PixelType,
typename TInputImageHV::PixelType,
typename TInputImageVH::PixelType,
typename TInputImageVV::PixelType,
typename TOutputImage::PixelType> >
class ITK_EXPORT SinclairImageFilter : public otb::QuaternaryFunctorImageFilter<TInputImageHH,
TInputImageHV, TInputImageVH,
TInputImageVV, TOutputImage,
TFunction>
{
public:
/** Standard typedefs */
typedef SinclairImageFilter Self;
typedef otb::QuaternaryFunctorImageFilter<TInputImageHH, TInputImageHV,
TInputImageVH, TInputImageVV, TOutputImage, TFunction> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Type macro */
itkNewMacro(Self);
/** Creation through object factory macro */
itkTypeMacro(SinclairImageFilter, QuaternaryFunctorImageFilter);
/** Template parameters typedefs */
typedef typename Superclass::Input1ImageType HHInputImageType;
typedef typename Superclass::Input1ImagePointer HHInputImagePointer;
typedef typename Superclass::Input2ImageType HVInputImageType;
typedef typename Superclass::Input2ImagePointer HVInputImagePointer;
typedef typename Superclass::Input3ImageType VHInputImageType;
typedef typename Superclass::Input3ImagePointer VHInputImagePointer;
typedef typename Superclass::Input4ImageType VVInputImageType;
typedef typename Superclass::Input4ImagePointer VVInputImagePointer;
typedef typename Superclass::OutputImageType OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename Superclass::FunctorType FunctorType;
void SetInputHH(const TInputImageHH * image);
void SetInputHV(const TInputImageHV * image);
void SetInputVH(const TInputImageVH * image);
void SetInputVV(const TInputImageVV * image);
protected:
/** Constructor */
SinclairImageFilter() {}
/** Destructor */
~SinclairImageFilter() override {}
void GenerateOutputInformation() override;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
SinclairImageFilter(const Self &) = delete;
void operator =(const Self&) = delete;
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbSinclairImageFilter.hxx"
#endif
#endif
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbSinclairImageFilter_hxx
#define otbSinclairImageFilter_hxx
#include "otbSinclairImageFilter.h"
#include "otbMath.h"
namespace otb
{
/**
* Connect one of the operands for pixel-wise addition
*/
template <class TInputImageHH, class TInputImageHV, class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction>
void
SinclairImageFilter<TInputImageHH, TInputImageHV, TInputImageVH, TInputImageVV, TOutputImage, TFunction>
::SetInputHH(const TInputImageHH * image)
{
this->SetInput1(image);
}
/**
* Connect one of the operands for pixel-wise addition
*/
template <class TInputImageHH, class TInputImageHV, class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction>
void
SinclairImageFilter<TInputImageHH, TInputImageHV, TInputImageVH, TInputImageVV, TOutputImage, TFunction>
::SetInputHV(const TInputImageHV * image)
{
this->SetInput2(image);
}
/**
* Connect one of the operands for pixel-wise addition
*/
template <class TInputImageHH, class TInputImageHV, class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction>
void
SinclairImageFilter<TInputImageHH, TInputImageHV, TInputImageVH, TInputImageVV, TOutputImage, TFunction>
::SetInputVH(const TInputImageVH * image)
{
this->SetInput3(image);
}
/**
* Connect one of the operands for pixel-wise addition
*/
template <class TInputImageHH, class TInputImageHV, class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction>
void
SinclairImageFilter<TInputImageHH, TInputImageHV, TInputImageVH, TInputImageVV, TOutputImage, TFunction>
::SetInputVV(const TInputImageVV * image)
{
this->SetInput4(image);
}
/**
* Printself
*/
template <class TInputImageHH, class TInputImageHV, class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction>
void
SinclairImageFilter<TInputImageHH, TInputImageHV, TInputImageVH, TInputImageVV, TOutputImage, TFunction>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
}
template <class TInputImageHH, class TInputImageHV, class TInputImageVH, class TInputImageVV, class TOutputImage,
class TFunction>
void
SinclairImageFilter<TInputImageHH, TInputImageHV, TInputImageVH, TInputImageVV, TOutputImage, TFunction>
::GenerateOutputInformation()
{
// Call to the superclass implementation
Superclass::GenerateOutputInformation();
typename Superclass::OutputImagePointer outputPtr = this->GetOutput();
// initialize the number of channels of the output image
outputPtr->SetNumberOfComponentsPerPixel( this->GetFunctor().GetNumberOfComponentsPerPixel() );
}
} // end namespace otb
#endif
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include "otbPolarimetryTags.h" #include "otbPolarimetryTags.h"
#include "otbFunctorImageFilter.h" #include "otbFunctorImageFilter.h"
#include "otbSinclairToCovarianceMatrixFunctor.h" #include "otbSinclairToCovarianceMatrixFunctor.h"
#include "otbSinclairToCircularCovarianceMatrixFunctor.h"
#include "otbSinclairToCoherencyMatrixFunctor.h"
#include "otbSinclairToMuellerMatrixFunctor.h"
namespace otb namespace otb
{ {
...@@ -34,6 +37,27 @@ using SinclairToCovarianceMatrixFilter = DefaultConstructibleFunctorImageFilter< ...@@ -34,6 +37,27 @@ using SinclairToCovarianceMatrixFilter = DefaultConstructibleFunctorImageFilter<
typename TInputImage::PixelType, typename TOutputImage::PixelType>, typename TInputImage::PixelType, typename TOutputImage::PixelType>,
std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>; std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>;
// This is the entire declaration of SinclairToCircularCovarianceMatrixFilter
template <typename TInputImage, typename TOutputImage>
using SinclairToCircularCovarianceMatrixFilter = DefaultConstructibleFunctorImageFilter<
Functor::SinclairToCircularCovarianceMatrixFunctor<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>>;
// This is the entire declaration of SinclairToCoherencyMatrixFilter
template <typename TInputImage, typename TOutputImage>
using SinclairToCoherencyMatrixFilter = DefaultConstructibleFunctorImageFilter<
Functor::SinclairToCoherencyMatrixFunctor<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>>;
// This is the entire declaration of SinclairToMuellerMatrixFilter
template <typename TInputImage, typename TOutputImage>
using SinclairToMuellerMatrixFilter = DefaultConstructibleFunctorImageFilter<
Functor::SinclairToMuellerMatrixFunctor<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 } // end namespace otb
......
...@@ -72,9 +72,7 @@ public: ...@@ -72,9 +72,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);
...@@ -102,9 +100,15 @@ public: ...@@ -102,9 +100,15 @@ public:
return (result); return (result);
} }
unsigned int GetNumberOfComponentsPerPixel() constexpr size_t OutputSize(...) const
{
// Size of coherency matrix
return 10;
}
constexpr size_t GetNumberOfComponentsPerPixel()
{ {
return m_NumberOfComponentsPerPixel; return OutputSize();
} }
/** Constructor */ /** Constructor */
...@@ -112,13 +116,6 @@ public: ...@@ -112,13 +116,6 @@ public:
/** Destructor */ /** Destructor */
virtual ~SinclairToCoherencyMatrixFunctor() {} virtual ~SinclairToCoherencyMatrixFunctor() {}
protected:
private:
//itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 10);
static const unsigned int m_NumberOfComponentsPerPixel = 10;
}; };
} // namespace Functor } // namespace Functor
......
...@@ -92,9 +92,7 @@ public: ...@@ -92,9 +92,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(16);
result.SetSize(m_NumberOfComponentsPerPixel);
const ComplexType Txx = static_cast<ComplexType>(-Shh); const ComplexType Txx = static_cast<ComplexType>(-Shh);
const ComplexType Txy = static_cast<ComplexType>(-Shv); const ComplexType Txy = static_cast<ComplexType>(-Shv);
...@@ -126,22 +124,22 @@ public: ...@@ -126,22 +124,22 @@ public:
return (result); return (result);
} }
unsigned int GetNumberOfComponentsPerPixel() constexpr size_t OutputSize(...) const
{
// Size of mueller matrix
return 16;
}
constexpr size_t GetNumberOfComponentsPerPixel()
{ {
return m_NumberOfComponentsPerPixel; return OutputSize();
} }
/** Constructor */ /** Constructor */
SinclairToMuellerMatrixFunctor() : m_NumberOfComponentsPerPixel(16) {} SinclairToMuellerMatrixFunctor() {}
/** Destructor */ /** Destructor */
virtual ~SinclairToMuellerMatrixFunctor() {} virtual ~SinclairToMuellerMatrixFunctor() {}
protected:
private:
unsigned int m_NumberOfComponentsPerPixel;
}; };
} // namespace Functor } // namespace Functor
......
...@@ -26,32 +26,30 @@ ...@@ -26,32 +26,30 @@
#include "otbImage.h" #include "otbImage.h"
#include "otbImageFileReader.h" #include "otbImageFileReader.h"
#include "otbImageFileWriter.h" #include "otbImageFileWriter.h"
#include "otbSinclairImageFilter.h" #include "otbSinclairImageFilters.h"
#include "otbSinclairToCircularCovarianceMatrixFunctor.h"
#include "otbSinclairToCoherencyMatrixFunctor.h"
#include "otbSinclairToMuellerMatrixFunctor.h"
#include "otbMultiChannelExtractROI.h" #include "otbMultiChannelExtractROI.h"
using namespace otb;
template<class TFilter>
template<class TInputPixel, class TOutputPixel, class TFunction>
int generic_SinclairImageFilter(int itkNotUsed(argc), char * argv[]) int generic_SinclairImageFilter(int itkNotUsed(argc), char * argv[])
{ {
const char * outputFilename = argv[4]; const char * outputFilename = argv[4];
typedef otb::VectorImage<TOutputPixel> OutputImageType; using OutputImageType = typename TFilter::OutputImageType;
using InputImageType = typename TFilter::Superclass::template InputImageType<0>;
using OutputPixelType = typename OutputImageType::InternalPixelType;
typedef otb::ImageFileWriter<OutputImageType> WriterType; typedef otb::ImageFileWriter<OutputImageType> WriterType;
const char * inputFilename1 = argv[1]; const char * inputFilename1 = argv[1];
const char * inputFilename2 = argv[2]; const char * inputFilename2 = argv[2];
const char * inputFilename3 = argv[3]; const char * inputFilename3 = argv[3];
typedef otb::Image<TInputPixel> InputImageType;
typedef otb::VectorImage<TOutputPixel> OutputImageType;
typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileReader<InputImageType> ReaderType;
typedef otb::MultiChannelExtractROI<TOutputPixel, TOutputPixel > ExtractROIType; typedef otb::MultiChannelExtractROI<OutputPixelType,OutputPixelType > ExtractROIType;
typedef otb::SinclairImageFilter<InputImageType, InputImageType, InputImageType, InputImageType, OutputImageType, TFunction> FilterType; using FilterType = TFilter;
typename FilterType::Pointer filter = FilterType::New(); typename FilterType::Pointer filter = FilterType::New();
typename ReaderType::Pointer reader1 = ReaderType::New(); typename ReaderType::Pointer reader1 = ReaderType::New();
typename ReaderType::Pointer reader2 = ReaderType::New(); typename ReaderType::Pointer reader2 = ReaderType::New();
...@@ -60,10 +58,10 @@ int generic_SinclairImageFilter(int itkNotUsed(argc), char * argv[]) ...@@ -60,10 +58,10 @@ int generic_SinclairImageFilter(int itkNotUsed(argc), char * argv[])
reader1->SetFileName(inputFilename1); reader1->SetFileName(inputFilename1);
reader2->SetFileName(inputFilename2); reader2->SetFileName(inputFilename2);
reader3->SetFileName(inputFilename3); reader3->SetFileName(inputFilename3);
filter->SetInputHH(reader1->GetOutput()); filter->SetVariadicNamedInput(polarimetry_tags::hh{},reader1->GetOutput());
filter->SetInputHV(reader2->GetOutput()); filter->SetVariadicNamedInput(polarimetry_tags::hv{},reader2->GetOutput());
filter->SetInputVH(reader2->GetOutput()); filter->SetVariadicNamedInput(polarimetry_tags::vh{},reader2->GetOutput());
filter->SetInputVV(reader3->GetOutput()); filter->SetVariadicNamedInput(polarimetry_tags::vv{},reader3->GetOutput());
filter->UpdateOutputInformation(); filter->UpdateOutputInformation();
...@@ -94,40 +92,26 @@ int otbSinclairImageFilter(int argc, char * argv[]) ...@@ -94,40 +92,26 @@ int otbSinclairImageFilter(int argc, char * argv[])
typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType;
typedef otb::VectorImage<OutputRealPixelType, Dimension> OutputRealImageType; 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>;
std::string strArgv(argv[1]); std::string strArgv(argv[1]);
argc--; argc--;
argv++; argv++;
if (strArgv == "SinclairToCovarianceMatrix") if (strArgv == "SinclairToCovarianceMatrix")
return (generic_SinclairImageFilter<InputPixelType, OutputPixelType, return (generic_SinclairImageFilter<CovSRFilterType>
otb::Functor::SinclairToCovarianceMatrixFunctor<InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
OutputImageType::PixelType> >
(argc, argv)); (argc, argv));
else if (strArgv == "SinclairToCircularCovarianceMatrix") else if (strArgv == "SinclairToCircularCovarianceMatrix")
return (generic_SinclairImageFilter<InputPixelType, OutputPixelType, return (generic_SinclairImageFilter<CCSRFilterType>
otb::Functor::SinclairToCircularCovarianceMatrixFunctor<InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
OutputImageType::PixelType> >
(argc, argv)); (argc, argv));
else if (strArgv == "SinclairToCoherencyMatrix") else if (strArgv == "SinclairToCoherencyMatrix")
return (generic_SinclairImageFilter<InputPixelType, OutputPixelType, return (generic_SinclairImageFilter<CohSRFilterType>
otb::Functor::SinclairToCoherencyMatrixFunctor<InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
OutputImageType::PixelType> >
(argc, argv)); (argc, argv));
else if (strArgv == "SinclairToMuellerMatrix") else if (strArgv == "SinclairToMuellerMatrix")
return (generic_SinclairImageFilter<InputPixelType, OutputRealPixelType, return (generic_SinclairImageFilter<MSRFilterType>
otb::Functor::SinclairToMuellerMatrixFunctor<InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
InputImageType::PixelType,
OutputRealImageType::PixelType> >
(argc, argv)); (argc, argv));
else return EXIT_FAILURE; else return EXIT_FAILURE;
......
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