diff --git a/app/otbTimeSeriesStats.cxx b/app/otbTimeSeriesStats.cxx index bfc3f77feeb7f6da61b22ca0acc7f6c90e2c1c7b..49977ea586c489594134064f7b4d8352490d2d3e 100644 --- a/app/otbTimeSeriesStats.cxx +++ b/app/otbTimeSeriesStats.cxx @@ -28,7 +28,7 @@ #include "otbWrapperInputImageListParameter.h" // Functors for NDVI operations -#include "otbUnaryFunctorImageFilter.h" +#include "otbFunctorImageFilter.h" #include "otbTimeSeriesFunctor.h" // Dates @@ -66,8 +66,7 @@ public: typedef otb::dates::SingleDate DateType; typedef otb::Functor::MultitemporalDensityFunctor<FloatVectorImageType::PixelType, LabelVectorImageType::PixelType> DensityFunctorType; - typedef otb::UnaryFunctorImageFilter<FloatVectorImageType, - LabelVectorImageType, DensityFunctorType> DensityFilterType; + typedef otb::FunctorImageFilter<DensityFunctorType> DensityFilterType; void DoUpdateParameters() { @@ -157,7 +156,7 @@ public: // Count images m_TemporalFilter = DensityFilterType::New(); m_TemporalFilter->SetInput(m_Concatener->GetOutput()); - m_TemporalFilter->GetFunctor().SetInputNoDataValue(GetParameterFloat("nodata")); + m_TemporalFilter->GetModifiableFunctor().SetInputNoDataValue(GetParameterFloat("nodata")); SetParameterOutputImage("out", m_TemporalFilter->GetOutput()); diff --git a/include/otbTimeSeriesFunctor.h b/include/otbTimeSeriesFunctor.h index d6f957b7a81212de8613d3fded9626be50e339dd..8f75fb454e76d3b7d90940fb81fe6a0a4b052d48 100644 --- a/include/otbTimeSeriesFunctor.h +++ b/include/otbTimeSeriesFunctor.h @@ -9,6 +9,7 @@ =========================================================================*/ +#include <array> namespace otb { @@ -28,25 +29,25 @@ class MultitemporalDensityFunctor public: - /** Return the index name */ - virtual std::string GetName() const + /* + * Pixel components: + * 1: number of images + */ + static constexpr std::size_t outputPixelSize{1}; + + std::size_t OutputSize(const std::array<size_t, 1>&) const { - return "Number of images in the stack"; + return outputPixelSize; } - unsigned int GetOutputSize(){ + std::size_t OutputSize() const + { return outputPixelSize; } // Constructor MultitemporalDensityFunctor() { - /* - * Pixel components: - * 1: number of images - */ - outputPixelSize = 1; - // input no-data value m_InputNoDataValue = 0; } @@ -66,8 +67,8 @@ public: // Output pixel TOutputLabel outLabel; - outLabel.SetSize(outputPixelSize); - outLabel.Fill(itk::NumericTraits<OutputLabelValueType>::Zero); + outLabel.SetSize(OutputSize()); + outLabel.Fill(0); int n = pixel.GetSize(); @@ -86,7 +87,6 @@ private: // no data values InputValueType m_InputNoDataValue; - int outputPixelSize; }; // MultitemporalDensityFunctor