Commit 37ec0c0b authored by Manuel Grizonnet's avatar Manuel Grizonnet

ENH: disagregate decompositions and mueller filters

parent f75252f6
......@@ -21,7 +21,10 @@
#include "otbWrapperApplication.h"
#include "otbWrapperApplicationFactory.h"
#include "otbPolarimetricFilters.h"
#include "otbReciprocalBarnesDecompImageFilter.h"
#include "otbReciprocalHuynenDecompImageFilter.h"
#include "otbReciprocalPauliDecompImageFilter.h"
#include "otbReciprocalHAlphaImageFilter.h"
#include "otbPerBandVectorImageFilter.h"
#include "itkMeanImageFilter.h"
......
......@@ -19,14 +19,16 @@
*/
#ifndef otbMuellerToPolarisationDegreeAndPowerFunctor_h
#define otbMuellerToPolarisationDegreeAndPowerFunctor_h
#ifndef otbMuellerToPolarisationDegreeAndPowerImageFilter_h
#define otbMuellerToPolarisationDegreeAndPowerImageFilter_h
#include "itkNumericTraits.h"
#include "itkMatrix.h"
#include "itkVector.h"
#include "otbMath.h"
#include "otbFunctorImageFilter.h"
namespace otb
{
......@@ -66,6 +68,8 @@ namespace Functor {
* - channel #2 : \f$ DegP_{min} \f$
* - channel #3 : \f$ DegP_{max} \f$
*
* Use otb::MuellerToPolarisationDegreeAndPowerImageFilter to apply
*
* \ingroup Functor
* \ingroup SARPolarimetry
*
......@@ -175,19 +179,29 @@ public:
// Size of the result
return 4;
}
/** Constructor */
MuellerToPolarisationDegreeAndPowerFunctor() : m_Epsilon(1e-6), m_PI_90(2*CONST_PI_180) {}
/** Destructor */
virtual ~MuellerToPolarisationDegreeAndPowerFunctor() {}
private:
const double m_Epsilon;
const double m_PI_90;
static constexpr double m_Epsilon = 1e-6;
static constexpr double m_PI_90 = 2*CONST_PI_180;
};
} // end namespace functor
/**
* \typedef MuellerToPolarisationDegreeAndPowerImageFilter
* \brief Applies otb::Functor::MuellerToPolarisationDegreeAndPowerFunctor
* \sa otb::Functor::MuellerToPolarisationDegreeAndPowerFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using MuellerToPolarisationDegreeAndPowerImageFilter =
FunctorImageFilter<Functor::MuellerToPolarisationDegreeAndPowerFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
#endif
......@@ -22,7 +22,7 @@
#ifndef otbMuellerToReciprocalCovarianceImageFilter_h
#define otbMuellerToReciprocalCovarianceImageFilter_h
#include "otbUnaryFunctorImageFilter.h"
#include "otbFunctorImageFilter.h"
namespace otb
{
......@@ -54,6 +54,8 @@ namespace Functor {
* The output image has 6 channels : the diagonal and the upper element of the reciprocal matrix.
* Element are stored from left to right, line by line.
*
* Use otb::MuellerToReciprocalCovarianceImageFilter to apply
*
* \ingroup Functor
* \ingroup SARPolarimetry
*
......@@ -71,7 +73,6 @@ public:
typedef std::complex<double> ComplexType;
typedef typename TOutput::ValueType OutputValueType;
inline void operator()( TOutput & result, const TInput & Mueller ) const
{
// Keep the upper diagonal of the matrix
......@@ -107,15 +108,26 @@ public:
// Size of the result
return 6;
}
/** Constructor */
MuellerToReciprocalCovarianceFunctor() {}
/** Destructor */
virtual ~MuellerToReciprocalCovarianceFunctor() {}
};
} // end namespace functor
/**
* \typedef MuellerToReciprocalCovarianceImageFilter
* \brief Applies otb::Functor::MuellerToReciprocalCovarianceFunctor
* \sa otb::Functor::MuellerToReciprocalCovarianceFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using MuellerToReciprocalCovarianceImageFilter =
FunctorImageFilter<Functor::MuellerToReciprocalCovarianceFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
#endif
......@@ -25,16 +25,6 @@
#include "otbPolarimetryTags.h"
#include "otbFunctorImageFilter.h"
// Decomposition functors
#include "otbReciprocalBarnesDecompFunctor.h"
#include "otbReciprocalHAlphaImageFunctor.h"
#include "otbReciprocalHuynenDecompFunctor.h"
#include "otbReciprocalPauliDecompFunctor.h"
// Mueller functor
#include "otbMuellerToPolarisationDegreeAndPowerFunctor.h"
#include "otbMuellerToReciprocalCovarianceFunctor.h"
// Other reciprocal filters
#include "otbReciprocalCoherencyToReciprocalMuellerFunctor.h"
#include "otbReciprocalCovarianceToCoherencyDegreeFunctor.h"
......@@ -43,44 +33,6 @@
namespace otb
{
//############################
// Polarimetric decompositions
//############################
// This is the entire declaration of ReciprocalHAlphaImageFilter
template <typename TInputImage, typename TOutputImage>
using ReciprocalHAlphaImageFilter =
FunctorImageFilter<Functor::ReciprocalHAlphaFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
// This is the entire declaration of ReciprocalBarnesDecompImageFilter
template <typename TInputImage, typename TOutputImage>
using ReciprocalBarnesDecompImageFilter =
FunctorImageFilter<Functor::ReciprocalBarnesDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
// This is the entire declaration of ReciprocalHuynenDecompImageFilter
template <typename TInputImage, typename TOutputImage>
using ReciprocalHuynenDecompImageFilter =
FunctorImageFilter<Functor::ReciprocalHuynenDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
// This is the entire declaration of ReciprocalPauliDecompImageFilter
template <typename TInputImage, typename TOutputImage>
using ReciprocalPauliDecompImageFilter =
FunctorImageFilter<Functor::ReciprocalPauliDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
//################
// Mueller filters
//################
// This is the entire declaration of MuellerToPolarisationDegreeAndPowerFilter
template <typename TInputImage, typename TOutputImage>
using MuellerToPolarisationDegreeAndPowerImageFilter =
FunctorImageFilter<Functor::MuellerToPolarisationDegreeAndPowerFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
// This is the entire declaration of MuellerToReciprocalCovarianceImageFilter
template <typename TInputImage, typename TOutputImage>
using MuellerToReciprocalCovarianceImageFilter =
FunctorImageFilter<Functor::MuellerToReciprocalCovarianceFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
//#########################
// Other reciprocal filters
//#########################
......
......@@ -19,13 +19,15 @@
*/
#ifndef otbReciprocalBarnesDecompFunctor_h
#define otbReciprocalBarnesDecompFunctor_h
#ifndef otbReciprocalBarnesDecompImageFilter_h
#define otbReciprocalBarnesDecompImageFilter_h
#include "otbMath.h"
#include "vnl/algo/vnl_complex_eigensystem.h"
#include <algorithm>
#include "otbFunctorImageFilter.h"
namespace otb
{
......@@ -35,6 +37,8 @@ namespace Functor {
*
* \brief Evaluate the Huynen decomposition from the reciprocal Sinclair matrix image.
*
* Use otb::BarnesDecompImageFilter to apply
*
* \ingroup OTBPolarimetry
*/
template< class TInput, class TOutput>
......@@ -101,17 +105,26 @@ public:
// Size of the result
return 9;
}
/** Constructor */
ReciprocalBarnesDecompFunctor() : m_Epsilon(1e-6) {}
/** Destructor */
virtual ~ReciprocalBarnesDecompFunctor() {}
private:
const double m_Epsilon;
static constexpr double m_Epsilon = 1e-6;
};
} // end namespace functor
/**
* \typedef ReciprocalBarnesDecompImageFilter
* \brief Applies otb::Functor::ReciprocalBarnesDecompFunctor
* \sa otb::Functor::ReciprocalBarnesDecompFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using ReciprocalBarnesDecompImageFilter =
FunctorImageFilter<Functor::ReciprocalBarnesDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
#endif
......@@ -19,8 +19,8 @@
*/
#ifndef otbReciprocalHAlphaFunctor_h
#define otbReciprocalHAlphaFunctor_h
#ifndef otbReciprocalHAlphaImageFilter_h
#define otbReciprocalHAlphaImageFilter_h
#include "otbMath.h"
#include "vnl/algo/vnl_complex_eigensystem.h"
......@@ -28,6 +28,8 @@
#include <vector>
#include <complex>
#include "otbFunctorImageFilter.h"
namespace otb
{
......@@ -40,6 +42,8 @@ namespace Functor {
* eigen values of the matrix sorted in decrease order. \f$ SortedEigenVector \f$ the corresponding list
* of eigen vector.
*
* Use otb::ReciprocalHAlphaImageFilter to apply
*
* Output value are:
* - channel #0 : \f$ entropy = -\sum_{i=0}^{2}{p[i].\log{p[i]}} / \log{3} \f$
* - channel #1 : \f$ \alpha = \sum_{i=0}^{2}{p[i].\alpha_{i} \f$
......@@ -170,17 +174,26 @@ public:
// Size of the result (entropy, alpha, anisotropy)
return 3;
}
/** Constructor */
ReciprocalHAlphaFunctor() {}
/** Destructor */
virtual ~ReciprocalHAlphaFunctor() {}
private:
static constexpr double m_Epsilon = 1e-6;
};
} // end namespace functor
/**
* \typedef ReciprocalHAlphaImageFilter
* \brief Applies otb::Functor::ReciprocalHAlphaFunctor
* \sa otb::Functor::ReciprocalHAlphaFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using ReciprocalHAlphaImageFilter =
FunctorImageFilter<Functor::ReciprocalHAlphaFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
#endif
......@@ -18,9 +18,10 @@
* limitations under the License.
*/
#ifndef otbReciprocalHuynenDecompImageFilter_h
#define otbReciprocalHuynenDecompImageFilter_h
#ifndef otbReciprocalHuynenDecompFunctor_h
#define otbReciprocalHuynenDecompFunctor_h
#include "otbFunctorImageFilter.h"
namespace otb
{
......@@ -31,6 +32,8 @@ namespace Functor {
*
* \brief Evaluate the Huynen decomposition from the reciprocal Sinclair matrix image.
*
* Use otb::HuynenDecompImageFilter to apply
*
* \ingroup OTBPolarimetry
*/
template< class TInput, class TOutput>
......@@ -40,7 +43,6 @@ public:
typedef typename TOutput::ValueType OutputValueType;
inline void operator()( TOutput & result, const TInput & Covariance ) const
{
OutputValueType A0 = static_cast<OutputValueType>(Covariance[0].real() / 2.0);
......@@ -70,16 +72,26 @@ public:
return 9;
}
/** Constructor */
ReciprocalHuynenDecompFunctor() : m_Epsilon(1e-6) {}
/** Destructor */
virtual ~ReciprocalHuynenDecompFunctor() {}
private:
const double m_Epsilon;
static constexpr double m_Epsilon = 1e-6;
};
} // end namespace functor
/**
* \typedef ReciprocalHuynenDecompImageFilter
* \brief Applies otb::Functor::ReciprocalHuynenDecompFunctor
* \sa otb::Functor::ReciprocalHuynenDecompFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using ReciprocalHuynenDecompImageFilter =
FunctorImageFilter<Functor::ReciprocalHuynenDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
#endif
......@@ -19,8 +19,10 @@
*/
#ifndef otbReciprocalPauliDecompFunctor_h
#define otbReciprocalPauliDecompFunctor_h
#ifndef otbReciprocalPauliDecompImageFilter_h
#define otbReciprocalPauliDecompImageFilter_h
#include "otbFunctorImageFilter.h"
namespace otb
{
......@@ -31,6 +33,8 @@ namespace Functor {
*
* \brief Evaluate the Pauli decomposition from the reciprocal Sinclair matrix image.
*
* Use otb::PauliDecompImageFilter to apply
*
* \ingroup OTBPolarimetry
*/
template< class TInput, class TOutput>
......@@ -41,7 +45,6 @@ public:
typedef typename TInput::ValueType InputValueType;
typedef typename TOutput::ValueType OutputValueType;
inline void operator()( TOutput & result, const TInput & Sinclair ) const
{
InputValueType sqrt2(std::sqrt(2.0),0.0);
......@@ -61,16 +64,27 @@ public:
return 3;
}
/** Constructor */
ReciprocalPauliDecompFunctor() {}
/** Destructor */
virtual ~ReciprocalPauliDecompFunctor() {}
private:
static constexpr double m_Epsilon = 1e-6;
};
} // end namespace functor
/**
* \typedef ReciprocalPauliDecompImageFilter
* \brief Applies otb::Functor::ReciprocalPauliDecompFunctor
* \sa otb::Functor::ReciprocalPauliDecompFunctor
*
* Set inputs with:
* \code
* SetVariadicInput<0>(inputPtr);
* \endcode
*
* \ingroup OTBPolarimetry
*/
template <typename TInputImage, typename TOutputImage>
using ReciprocalPauliDecompImageFilter =
FunctorImageFilter<Functor::ReciprocalPauliDecompFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
} // end namespace otb
#endif
......@@ -45,10 +45,10 @@ namespace Functor
* - channel #8 : \f$ S_{vh}.S_{vv}^{*} \f$
* - channel #9 : \f$ S_{vv}.S_{vv}^{*} \f$
*
* The output pixel has 10 channels : the diagonal and the upper element of the matrix.
* Element are stored from left to right, line by line.
* The output pixel has 10 channels : the diagonal and the upper element of the matrix.
* Element are stored from left to right, line by line.
*
* Use otb::SinclairToCovarianceMatrixImageFilter to apply
* Use otb::SinclairToCovarianceMatrixImageFilter to apply
* it to an image.
*
* \ingroup Functor
......
......@@ -26,7 +26,7 @@
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbPolarimetricFilters.h"
#include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h"
int otbMuellerToPolarisationDegreeAndPowerImageFilter(int itkNotUsed(argc), char * argv[])
{
......
......@@ -20,7 +20,7 @@
#include "itkMacro.h"
#include "otbPolarimetricFilters.h"
#include "otbMuellerToReciprocalCovarianceImageFilter.h"
#include "itkVariableLengthVector.h"
#include <complex>
......
......@@ -26,7 +26,7 @@
#include "otbImageFileWriter.h"
#include "otbExtractROI.h"
#include "otbPolarimetricFilters.h"
#include "otbMuellerToReciprocalCovarianceImageFilter.h"
int otbMuellerToReciprocalCovarianceImageFilter(int itkNotUsed(argc), char * argv[])
{
......
......@@ -29,7 +29,7 @@
#include "itkMeanImageFilter.h"
#include "otbPerBandVectorImageFilter.h"
#include "otbPolarimetricFilters.h"
#include "otbReciprocalBarnesDecompImageFilter.h"
#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
int otbReciprocalBarnesDecompImageFilter(int itkNotUsed(argc), char * argv[])
......
......@@ -29,7 +29,7 @@
#include "itkMeanImageFilter.h"
#include "otbPerBandVectorImageFilter.h"
#include "otbPolarimetricFilters.h"
#include "otbReciprocalHAlphaImageFilter.h"
#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
int otbReciprocalHAlphaImageFilter(int itkNotUsed(argc), char * argv[])
......
......@@ -30,7 +30,7 @@
#include "otbPerBandVectorImageFilter.h"
#include "otbPolarimetricFilters.h"
#include "otbReciprocalHuynenDecompImageFilter.h"
#include "otbSinclairToReciprocalCovarianceMatrixImageFilter.h"
int otbReciprocalHuynenDecompImageFilter(int itkNotUsed(argc), char * argv[])
......
......@@ -29,7 +29,7 @@
#include "otbNRIBandImagesToOneNComplexBandsImage.h"
#include "otbPolarimetricFilters.h"
#include "otbReciprocalPauliDecompImageFilter.h"
int otbReciprocalPauliDecompImageFilter(int itkNotUsed(argc), char * argv[])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment