From 1fdea835b16845ec4c5ff0c8a9765929e0293a4a Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@cnes.fr> Date: Mon, 17 Dec 2018 17:03:29 +0100 Subject: [PATCH] ENH: move bistatic filters in separate files --- .../include/otbPolarimetricFilters.h | 31 ----------------- ...inclairToCircularCovarianceMatrixFunctor.h | 34 +++++++++++++++++-- .../otbSinclairToCoherencyMatrixFunctor.h | 33 ++++++++++++++++-- .../otbSinclairToCovarianceMatrixFunctor.h | 10 +++--- .../otbSinclairToMuellerMatrixFunctor.h | 33 ++++++++++++++++-- 5 files changed, 96 insertions(+), 45 deletions(-) diff --git a/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h b/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h index e6ffc96ea8..367627599d 100644 --- a/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h +++ b/Modules/Filtering/Polarimetry/include/otbPolarimetricFilters.h @@ -54,37 +54,6 @@ namespace otb { -//################# -// Bistatic filters -//################# - -// 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>>; - -// This is the entire declaration of SinclairToCircularCovarianceMatrixFilter -template <typename TInputImage, typename TOutputImage> -using SinclairToCircularCovarianceMatrixFilter = FunctorImageFilter< - 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 = FunctorImageFilter< - 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 = FunctorImageFilter< - 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>>; //################### // Monostatic filters diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h index da67daeb39..0984c6a9c8 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h @@ -18,11 +18,14 @@ * limitations under the License. */ -#ifndef otbSinclairToCircularCovarianceMatrixFunctor_h -#define otbSinclairToCircularCovarianceMatrixFunctor_h +#ifndef otbSinclairToCircularCovarianceMatrixImageFilter_h +#define otbSinclairToCircularCovarianceMatrixImageFilter_h #include <complex> + #include "otbSinclairToCovarianceMatrixFunctor.h" +#include "otbFunctorImageFilter.h" +#include "otbPolarimetryTags.h" namespace otb { @@ -55,6 +58,8 @@ namespace Functor * 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::SinclairToCircularCovarianceMatrixImageFilter to apply it to an image. + * * \ingroup Functor * \ingroup SARPolarimetry * @@ -80,7 +85,7 @@ public: typedef typename TOutput::ValueType OutputValueType; typedef SinclairToCovarianceMatrixFunctor<ComplexType, ComplexType, ComplexType, ComplexType, TOutput> SinclairToCovarianceFunctorType; inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, - const TInput3& Svh, const TInput4& Svv) + const TInput3& Svh, const TInput4& Svv) const { const ComplexType S_hh = static_cast<ComplexType>(Shh); const ComplexType S_hv = static_cast<ComplexType>(Shv); @@ -117,6 +122,29 @@ public: }; } // namespace Functor + + /** + * \typedef SinclairToCircularCovarianceMatrixImageFilter + * \brief Applies otb::Functor::SinclairToCircularCovarianceMatrixFunctor + * \sa otb::Functor::SinclairToCircularCovarianceMatrixFunctor + * + * Set inputs with: + * \code + * + * SetVariadicNamedInput<polarimetry_tags::hh>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::hv>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::vh>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::vv>(inputPtr); + * + * \endcode + * + * \ingroup OTBPolarimetry + */ + template <typename TInputImage, typename TOutputImage> +using SinclairToCircularCovarianceMatrixImageFilter = FunctorImageFilter< + 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>>; } // namespace otb #endif diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h index 6356266ab3..ac39c5f741 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCoherencyMatrixFunctor.h @@ -18,10 +18,12 @@ * limitations under the License. */ -#ifndef otbSinclairToCoherencyMatrixFunctor_h -#define otbSinclairToCoherencyMatrixFunctor_h +#ifndef otbSinclairToCoherencyMatrixImageFilter_h +#define otbSinclairToCoherencyMatrixImageFilter_h #include <complex> +#include "otbFunctorImageFilter.h" +#include "otbPolarimetryTags.h" namespace otb { @@ -46,6 +48,8 @@ namespace Functor * 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::SinclairToCoherencyMatrixImageFilter to apply it to an image. + * * \ingroup Functor * \ingroup SARPolarimetry * @@ -70,7 +74,7 @@ public: typedef std::complex <RealType> ComplexType; typedef typename TOutput::ValueType OutputValueType; inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, - const TInput3& Svh, const TInput4& Svv) + const TInput3& Svh, const TInput4& Svv) const { const ComplexType S_hh = static_cast<ComplexType>(Shh); const ComplexType S_hv = static_cast<ComplexType>(Shv); @@ -110,6 +114,29 @@ public: }; } // namespace Functor + + /** + * \typedef SinclairToCoherencyMatrixImageFilter + * \brief Applies otb::Functor::SinclairToCoherencyMatrixFunctor + * \sa otb::Functor::SinclairToCoherencyMatrixFunctor + * + * Set inputs with: + * \code + * + * SetVariadicNamedInput<polarimetry_tags::hh>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::hv>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::vh>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::vv>(inputPtr); + * + * \endcode + * + * \ingroup OTBPolarimetry + */ + template <typename TInputImage, typename TOutputImage> +using SinclairToCoherencyMatrixImageFilter = FunctorImageFilter< + 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>>; } // namespace otb #endif diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h index 1fc404172f..982090a904 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCovarianceMatrixFunctor.h @@ -18,8 +18,8 @@ * limitations under the License. */ -#ifndef otbSinclairToCovarianceMatrixFunctor_h -#define otbSinclairToCovarianceMatrixFunctor_h +#ifndef otbSinclairToCovarianceMatrixImageFilter_h +#define otbSinclairToCovarianceMatrixImageFilter_h #include <complex> #include "otbFunctorImageFilter.h" @@ -48,7 +48,7 @@ namespace Functor * 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::SinclairToCovarianceMatrixFilter to apply + * Use otb::SinclairToCovarianceMatrixImageFilter to apply * it to an image. * * \ingroup Functor @@ -101,7 +101,7 @@ public: } // namespace Functor /** - * \typedef SinclairToCovarianceMatrixFilter + * \typedef SinclairToCovarianceMatrixImageFilter * \brief Applies otb::Functor::SinclairToCovarianceMatrixFunctor * \sa otb::Functor::SinclairToCovarianceMatrixFunctor * @@ -118,7 +118,7 @@ public: * \ingroup OTBPolarimetry */ template <typename TInputImage, typename TOutputImage> - using SinclairToCovarianceMatrixFilter = FunctorImageFilter< + using SinclairToCovarianceMatrixImageFilter = 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>>; diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h index 1744067128..3284358a07 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h @@ -18,10 +18,12 @@ * limitations under the License. */ -#ifndef otbSinclairToMuellerMatrixFunctor_h -#define otbSinclairToMuellerMatrixFunctor_h +#ifndef otbSinclairToMuellerMatrixImageFilter_h +#define otbSinclairToMuellerMatrixImageFilter_h #include <complex> +#include "otbFunctorImageFilter.h" +#include "otbPolarimetryTags.h" namespace otb { @@ -65,6 +67,7 @@ namespace Functor * {channel #12}&{channel #13}&{channel #14}&{channel #15} \\ * \end{pmatrix} \f$ * + * Use otb::otbSinclairToMuellerMatrixImageFilter to apply it to an image. * \ingroup Functor * \ingroup SARPolarimetry * @@ -90,7 +93,7 @@ public: typedef double RealType; inline void operator ()(TOutput & result, const TInput1& Shh, const TInput2& Shv, - const TInput3& Svh, const TInput4& Svv) + const TInput3& Svh, const TInput4& Svv) const { const ComplexType Txx = static_cast<ComplexType>(-Shh); const ComplexType Txy = static_cast<ComplexType>(-Shv); @@ -134,6 +137,30 @@ public: }; } // namespace Functor + +/** + * \typedef SinclairToMuellerMatrixImageFilter + * \brief Applies otb::Functor::SinclairToMuellerMatrixFunctor + * \sa otb::Functor::SinclairToCircularCovarianceMatrixFunctor + * + * Set inputs with: + * \code + * + * SetVariadicNamedInput<polarimetry_tags::hh>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::hv>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::vh>(inputPtr); + * SetVariadicNamedInput<polarimetry_tags::vv>(inputPtr); + * + * \endcode + * + * \ingroup OTBPolarimetry + */ +template <typename TInputImage, typename TOutputImage> +using SinclairToMuellerMatrixImageFilter = FunctorImageFilter< + 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>>; + } // namespace otb #endif -- GitLab