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);
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;
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();
469 #ifndef OTB_MANUAL_INSTANTIATION
Compute the density of a neighborhood centerred in a pixel.
This filter link a persistent filter with a StreamingImageVirtualWriter.
This filter is the base class for all filter persisting data through multiple update....
Computes mean radiometric value for each label of a label image, based on a support VectorImage.
void operator=(const Self &)=delete
~PersistentStreamingStatisticsMapFromLabelImageFilter() override
TInputVectorImage::Pointer InputVectorImagePointer
itk::DataObject::Pointer DataObjectPointer
itk::SmartPointer< Self > Pointer
VectorImageType::PixelType::ValueType VectorPixelValueType
std::unordered_map< LabelPixelType, RealVectorPixelType > PixelValueMapType
std::unordered_map< LabelPixelType, double > LabelPopulationMapType
itk::VariableLengthVector< double > RealVectorPixelType
TInputVectorImage VectorImageType
PersistentImageFilter< TInputVectorImage, TInputVectorImage > Superclass
PixelValueMapType m_MaxRadiometricValue
std::vector< AccumulatorMapType > AccumulatorMapCollectionType
LabelPopulationMapType m_LabelPopulation
LabelImageType::PixelType LabelPixelType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
PixelValueMapType m_StDevRadiometricValue
ImageBaseType::RegionType InputImageRegionType
itk::ImageBase< InputImageDimension > ImageBaseType
PixelValueMapType m_MinRadiometricValue
AccumulatorMapCollectionType m_AccumulatorMaps
StatisticsAccumulator< RealVectorPixelType > AccumulatorType
itk::SimpleDataObjectDecorator< PixelValueMapType > PixelValueMapObjectType
VectorPixelValueType m_NoDataValue
itk::SmartPointer< const Self > ConstPointer
PersistentStreamingStatisticsMapFromLabelImageFilter Self
TLabelImage::Pointer LabelImagePointer
VectorImageType::PixelType VectorPixelType
PersistentStreamingStatisticsMapFromLabelImageFilter(const Self &)=delete
std::unordered_map< LabelPixelType, AccumulatorType > AccumulatorMapType
TLabelImage LabelImageType
VectorImageType::RegionType RegionType
PixelValueMapType m_MeanRadiometricValue
StatisticsAccumulator(RealValueType noDataValue, bool useNoDataValue, const TRealVectorPixelType &pixel)
TRealVectorPixelType m_Min
itk::VariableLengthVector< PixelCountType > PixelCountVectorType
void Update(const TRealVectorPixelType &pixel)
std::uint64_t PixelCountType
TRealVectorPixelType m_Sum
RealValueType m_NoDataValue
void Update(const StatisticsAccumulator &other)
PixelCountVectorType m_BandCount
typename TRealVectorPixelType::ValueType RealValueType
TRealVectorPixelType m_SqSum
TRealVectorPixelType m_Max
void UpdateValues(PixelCountType otherCount, RealValueType otherSum, RealValueType otherSqSum, RealValueType otherMin, RealValueType otherMax, PixelCountType &count, RealValueType &sum, RealValueType &sqSum, RealValueType &min, RealValueType &max)
Computes mean radiometric value for each label of a label image, based on a support VectorImage.
void operator=(const Self &)=delete
void SetInputLabelImage(const LabelImageType *input)
PersistentFilterStreamingDecorator< PersistentStreamingStatisticsMapFromLabelImageFilter< TInputVectorImage, TLabelImage > > Superclass
TInputVectorImage VectorImageType
VectorImageType::PixelType::ValueType VectorPixelValueType
const VectorImageType * GetInput()
void SetUseNoDataValue(bool useNoDataValue)
VectorImageType::PixelType VectorPixelType
Superclass::FilterType::LabelPopulationMapType LabelPopulationMapType
Superclass::FilterType::PixelValueMapObjectType PixelValueMapObjectType
StreamingStatisticsMapFromLabelImageFilter Self
PixelValueMapType GetMeanValueMap() const
bool GetUseNoDataValue() const
LabelPopulationMapType GetLabelPopulationMap() const
TLabelImage LabelImageType
itk::SmartPointer< const Self > ConstPointer
void SetInput(const VectorImageType *input)
PixelValueMapType GetStandardDeviationValueMap() const
VectorPixelValueType GetNoDataValue() const
PixelValueMapType GetMinValueMap() const
~StreamingStatisticsMapFromLabelImageFilter() override
StreamingStatisticsMapFromLabelImageFilter()
void SetNoDataValue(VectorPixelValueType value)
const LabelImageType * GetInputLabelImage()
itk::SmartPointer< Self > Pointer
Superclass::FilterType::PixelValueMapType PixelValueMapType
StreamingStatisticsMapFromLabelImageFilter(const Self &)=delete
PixelValueMapType GetMaxValueMap() const
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.