22 #ifndef otbStreamingStatisticsMapFromLabelImageFilter_h
23 #define otbStreamingStatisticsMapFromLabelImageFilter_h
26 #include "itkNumericTraits.h"
28 #include "itkSimpleDataObjectDecorator.h"
30 #include <unordered_map>
52 template <
class TRealVectorPixelType>
71 m_Sum.SetSize(pixel.GetSize());
72 m_Min.SetSize(pixel.GetSize());
73 m_Max.SetSize(pixel.GetSize());
74 m_SqSum.SetSize(pixel.GetSize());
75 for (
unsigned int band = 0; band < pixel.GetSize(); band++)
77 auto val = pixel[band];
89 m_Sum[band] = itk::NumericTraits<RealValueType>::ZeroValue();
90 m_Min[band] = itk::NumericTraits<RealValueType>::max();
91 m_Max[band] = itk::NumericTraits<RealValueType>::min();
92 m_SqSum[band] = itk::NumericTraits<RealValueType>::ZeroValue();
98 void Update(
const TRealVectorPixelType& pixel)
101 const unsigned int nBands = pixel.GetSize();
102 for (
unsigned int band = 0; band < nBands; band++)
118 const unsigned int nBands = other.
m_Sum.GetSize();
119 for (
unsigned int band = 0; band < nBands; band++)
128 itkGetMacro(Sum, TRealVectorPixelType);
129 itkGetMacro(SqSum, TRealVectorPixelType);
130 itkGetMacro(Min, TRealVectorPixelType);
131 itkGetMacro(Max, TRealVectorPixelType);
132 itkGetMacro(
Count,
double);
176 template <
class TInputVectorImage,
class TLabelImage>
209 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputVectorImage::ImageDimension);
212 itkStaticConstMacro(ImageDimension,
unsigned int, TInputVectorImage::ImageDimension);
216 itkGetMacro(UseNoDataValue,
bool);
217 itkSetMacro(UseNoDataValue,
bool);
253 using Superclass::MakeOutput;
258 void AllocateOutputs()
override;
260 void GenerateOutputInformation()
override;
262 void Synthetize(
void)
override;
264 void Reset(
void)
override;
269 void GenerateInputRequestedRegion()
override;
276 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
278 void ThreadedGenerateData(
const RegionType& outputRegionForThread, itk::ThreadIdType threadId)
override;
282 void operator=(
const Self&) =
delete;
343 template <
class TInputVectorImage,
class TLabelImage>
372 using Superclass::SetInput;
375 this->GetFilter()->SetInput(input);
382 return this->GetFilter()->GetInput();
388 this->GetFilter()->SetInputLabelImage(input);
394 return this->GetFilter()->GetInputLabelImage();
400 return this->GetFilter()->GetMeanValueMap();
406 return this->GetFilter()->GetStandardDeviationValueMap();
412 return this->GetFilter()->GetMinValueMap();
418 return this->GetFilter()->GetMaxValueMap();
424 return this->GetFilter()->GetLabelPopulationMap();
430 this->GetFilter()->SetNoDataValue(value);
436 return this->GetFilter()->GetNoDataValue();
442 this->GetFilter()->SetUseNoDataValue(useNoDataValue);
448 return this->GetFilter()->GetUseNoDataValue();
464 void operator=(
const Self&) =
delete;
469 #ifndef OTB_MANUAL_INSTANTIATION