Commit 60674a93 authored by Cresson Remi's avatar Cresson Remi

REFAC: use otbImageFunctor

parent bab841be
......@@ -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());
......
......@@ -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
......
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