12 #ifndef __mitkExtendedLabelStatisticsImageFilter 13 #define __mitkExtendedLabelStatisticsImageFilter 15 #include "itkLabelStatisticsImageFilter.h" 29 template<
class TInputImage,
class TLabelImage >
35 typedef LabelStatisticsImageFilter < TInputImage, TLabelImage >
Superclass;
39 typedef typename Superclass::RealType
RealType;
46 itkFactorylessNewMacro( Self );
47 itkCloneMacro( Self );
63 m_Count = NumericTraits< IdentifierType >::ZeroValue();
65 m_Sum = NumericTraits< RealType >::ZeroValue();
74 m_Maximum = NumericTraits< RealType >::NonpositiveMin();
77 m_Mean = NumericTraits< RealType >::ZeroValue();
78 m_Sigma = NumericTraits< RealType >::ZeroValue();
79 m_Variance = NumericTraits< RealType >::ZeroValue();
80 m_MPP = NumericTraits< RealType >::ZeroValue();
81 m_Median = NumericTraits< RealType >::ZeroValue();
83 m_UPP = NumericTraits< RealType >::ZeroValue();
84 m_Entropy = NumericTraits< RealType >::ZeroValue();
85 m_Skewness = NumericTraits< RealType >::ZeroValue();
86 m_Kurtosis = NumericTraits< RealType >::ZeroValue();
88 unsigned int imageDimension = itkGetStaticConstMacro(ImageDimension);
90 for (
unsigned int i = 0; i < imageDimension * 2; i += 2 )
93 m_BoundingBox[i + 1] = NumericTraits< IndexValueType >::NonpositiveMin();
102 m_Count = NumericTraits< IdentifierType >::ZeroValue();
104 m_Sum = NumericTraits< RealType >::ZeroValue();
113 m_Maximum = NumericTraits< RealType >::NonpositiveMin();
116 m_Mean = NumericTraits< RealType >::ZeroValue();
117 m_Sigma = NumericTraits< RealType >::ZeroValue();
118 m_Variance = NumericTraits< RealType >::ZeroValue();
119 m_MPP = NumericTraits< RealType >::ZeroValue();
120 m_Median = NumericTraits< RealType >::ZeroValue();
122 m_UPP = NumericTraits< RealType >::ZeroValue();
123 m_Entropy = NumericTraits< RealType >::ZeroValue();
124 m_Skewness = NumericTraits< RealType >::ZeroValue();
125 m_Kurtosis = NumericTraits< RealType >::ZeroValue();
128 unsigned int imageDimension = itkGetStaticConstMacro(ImageDimension);
130 for (
unsigned int i = 0; i < imageDimension * 2; i += 2 )
133 m_BoundingBox[i + 1] = NumericTraits< IndexValueType >::NonpositiveMin();
138 typename HistogramType::SizeType hsize;
139 typename HistogramType::MeasurementVectorType lb;
140 typename HistogramType::MeasurementVectorType ub;
231 typedef itksys::hash_map< LabelPixelType, LabelStatistics >
MapType;
240 RealType
GetMinimum(LabelPixelType label)
const;
243 RealType
GetMaximum(LabelPixelType label)
const;
246 RealType
GetMean(LabelPixelType label)
const;
249 RealType
GetSigma(LabelPixelType label)
const;
258 RegionType
GetRegion(LabelPixelType label)
const;
261 RealType
GetSum(LabelPixelType label)
const;
264 MapSizeType
GetCount(LabelPixelType label)
const;
267 HistogramType::Pointer
GetHistogram(LabelPixelType label)
const;
273 RealType
GetMedian( LabelPixelType label)
const;
274 RealType
GetEntropy( LabelPixelType label)
const;
275 RealType
GetMPP( LabelPixelType label)
const;
276 RealType
GetUPP( LabelPixelType label)
const;
285 RealType upperBound);
289 std::map<LabelPixelType, PixelType> upperBound);
293 m_GlobalHistogramParametersSet(false),
294 m_MaskNonEmpty(false),
295 m_LabelHistogramParametersSet(false),
296 m_PreferGlobalHistogramParameters(false)
298 m_NumBins.set_size(1);
310 outputRegionForThread,
311 ThreadIdType threadId)
override;
317 return m_LabelStatistics.find(label) != m_LabelStatistics.end();
321 std::vector< MapType > m_LabelStatisticsPerThread;
322 MapType m_LabelStatistics;
323 ValidLabelValuesContainerType m_ValidLabelValues;
325 bool m_GlobalHistogramParametersSet;
327 typename HistogramType::SizeType m_NumBins;
329 RealType m_LowerBound;
330 RealType m_UpperBound;
334 bool m_LabelHistogramParametersSet;
335 std::map<LabelPixelType, PixelType> m_LabelMin, m_LabelMax;
336 std::map<LabelPixelType, unsigned int> m_LabelNBins;
337 bool m_PreferGlobalHistogramParameters;
343 #ifndef ITK_MANUAL_INSTANTIATION 344 #include "mitkExtendedLabelStatisticsImageFilter.hxx"
Statistics stored per label.
BoundingBoxType GetBoundingBox(LabelPixelType label) const
Superclass::RealType RealType
bool HasLabel(LabelPixelType label) const
RealType m_SumOfPositivePixels
IdentifierType MapSizeType
HistogramType::Pointer GetHistogram(LabelPixelType label) const
Extension of the itkLabelStatisticsImageFilter that also calculates the Skewness,Kurtosis,Entropy,Uniformity.
RealType m_SumOfQuadruples
void SetHistogramParametersForLabels(std::map< LabelPixelType, unsigned int > numBins, std::map< LabelPixelType, PixelType > lowerBound, std::map< LabelPixelType, PixelType > upperBound)
Superclass::RegionType RegionType
Superclass::PixelType PixelType
Superclass::BoundingBoxType m_BoundingBox
RealType GetMean(LabelPixelType label) const
void ThreadedGenerateData(const typename TInputImage::RegionType &outputRegionForThread, ThreadIdType threadId) override
RealType GetSigma(LabelPixelType label) const
LabelStatistics & operator=(const LabelStatistics &l)
bool GetMaskingNonEmpty() const
RealType GetVariance(LabelPixelType label) const
void AfterThreadedGenerateData() override
SmartPointer< const Self > ConstPointer
std::vector< LabelPixelType > ValidLabelValuesContainerType
RegionType GetRegion(LabelPixelType label) const
void SetHistogramParameters(const int numBins, RealType lowerBound, RealType upperBound)
RealType GetMedian(LabelPixelType label) const
MapSizeType GetCount(LabelPixelType label) const
RealType GetMinimum(LabelPixelType label) const
RealType GetKurtosis(LabelPixelType label) const
itk::Statistics::Histogram< double > HistogramType
SmartPointer< Self > Pointer
~ExtendedLabelStatisticsImageFilter() override
itk::BoundingBox< unsigned long, 3, mitk::ScalarType > BoundingBoxType
RealType GetUniformity(LabelPixelType label) const
IdentifierType m_PositivePixelCount
ExtendedLabelStatisticsImageFilter Self
itksys::hash_map< LabelPixelType, LabelStatistics >::iterator StatisticsMapIterator
RealType GetSum(LabelPixelType label) const
Superclass::MapIterator MapIterator
RealType GetEntropy(LabelPixelType label) const
RealType GetUPP(LabelPixelType label) const
Superclass::LabelPixelType LabelPixelType
itksys::hash_map< LabelPixelType, LabelStatistics >::const_iterator StatisticsMapConstIterator
RealType GetSkewness(LabelPixelType label) const
RealType GetMPP(LabelPixelType label) const
HistogramType::Pointer m_Histogram
RealType GetMaximum(LabelPixelType label) const
std::list< int > GetRelevantLabels() const
LabelStatistics(int size, RealType lowerBound, RealType upperBound)
Superclass::BoundingBoxType BoundingBoxType
LabelStatistics(const LabelStatistics &l)
itksys::hash_map< LabelPixelType, LabelStatistics > MapType
ExtendedLabelStatisticsImageFilter()
LabelStatisticsImageFilter< TInputImage, TLabelImage > Superclass
void BeforeThreadedGenerateData() override