16 #ifndef __mitkExtendedLabelStatisticsImageFilter
17 #define __mitkExtendedLabelStatisticsImageFilter
19 #include "itkLabelStatisticsImageFilter.h"
33 template<
class TInputImage,
class TLabelImage >
39 typedef LabelStatisticsImageFilter < TInputImage, TLabelImage >
Superclass;
43 typedef typename Superclass::RealType
RealType;
50 itkFactorylessNewMacro( Self );
51 itkCloneMacro( Self );
67 m_Count = NumericTraits< IdentifierType >::ZeroValue();
69 m_Sum = NumericTraits< RealType >::ZeroValue();
78 m_Maximum = NumericTraits< RealType >::NonpositiveMin();
81 m_Mean = NumericTraits< RealType >::ZeroValue();
82 m_Sigma = NumericTraits< RealType >::ZeroValue();
83 m_Variance = NumericTraits< RealType >::ZeroValue();
84 m_MPP = NumericTraits< RealType >::ZeroValue();
85 m_Median = NumericTraits< RealType >::ZeroValue();
87 m_UPP = NumericTraits< RealType >::ZeroValue();
88 m_Entropy = NumericTraits< RealType >::ZeroValue();
89 m_Skewness = NumericTraits< RealType >::ZeroValue();
90 m_Kurtosis = NumericTraits< RealType >::ZeroValue();
92 unsigned int imageDimension = itkGetStaticConstMacro(ImageDimension);
94 for (
unsigned int i = 0; i < imageDimension * 2; i += 2 )
97 m_BoundingBox[i + 1] = NumericTraits< IndexValueType >::NonpositiveMin();
106 m_Count = NumericTraits< IdentifierType >::ZeroValue();
108 m_Sum = NumericTraits< RealType >::ZeroValue();
117 m_Maximum = NumericTraits< RealType >::NonpositiveMin();
120 m_Mean = NumericTraits< RealType >::ZeroValue();
121 m_Sigma = NumericTraits< RealType >::ZeroValue();
122 m_Variance = NumericTraits< RealType >::ZeroValue();
123 m_MPP = NumericTraits< RealType >::ZeroValue();
124 m_Median = NumericTraits< RealType >::ZeroValue();
126 m_UPP = NumericTraits< RealType >::ZeroValue();
127 m_Entropy = NumericTraits< RealType >::ZeroValue();
128 m_Skewness = NumericTraits< RealType >::ZeroValue();
129 m_Kurtosis = NumericTraits< RealType >::ZeroValue();
132 unsigned int imageDimension = itkGetStaticConstMacro(ImageDimension);
134 for (
unsigned int i = 0; i < imageDimension * 2; i += 2 )
137 m_BoundingBox[i + 1] = NumericTraits< IndexValueType >::NonpositiveMin();
142 typename HistogramType::SizeType hsize;
143 typename HistogramType::MeasurementVectorType lb;
144 typename HistogramType::MeasurementVectorType ub;
235 typedef itksys::hash_map< LabelPixelType, LabelStatistics >
MapType;
244 RealType
GetMinimum(LabelPixelType label)
const;
247 RealType
GetMaximum(LabelPixelType label)
const;
250 RealType
GetMean(LabelPixelType label)
const;
253 RealType
GetSigma(LabelPixelType label)
const;
262 RegionType
GetRegion(LabelPixelType label)
const;
265 RealType
GetSum(LabelPixelType label)
const;
268 MapSizeType
GetCount(LabelPixelType label)
const;
277 RealType
GetMedian( LabelPixelType label)
const;
278 RealType
GetEntropy( LabelPixelType label)
const;
279 RealType
GetMPP( LabelPixelType label)
const;
280 RealType
GetUPP( LabelPixelType label)
const;
289 RealType upperBound);
293 std::map<LabelPixelType, PixelType> upperBound);
297 m_GlobalHistogramParametersSet(false),
298 m_LabelHistogramParametersSet(false),
299 m_PreferGlobalHistogramParameters(false)
301 m_NumBins.set_size(1);
313 outputRegionForThread,
314 ThreadIdType threadId);
320 return m_LabelStatistics.find(label) != m_LabelStatistics.end();
324 std::vector< MapType > m_LabelStatisticsPerThread;
325 MapType m_LabelStatistics;
326 ValidLabelValuesContainerType m_ValidLabelValues;
328 bool m_GlobalHistogramParametersSet;
330 typename HistogramType::SizeType m_NumBins;
332 RealType m_LowerBound;
333 RealType m_UpperBound;
337 bool m_LabelHistogramParametersSet;
338 std::map<LabelPixelType, PixelType> m_LabelMin, m_LabelMax;
339 std::map<LabelPixelType, unsigned int> m_LabelNBins;
340 bool m_PreferGlobalHistogramParameters;
346 #ifndef ITK_MANUAL_INSTANTIATION
347 #include "mitkExtendedLabelStatisticsImageFilter.hxx"
void AfterThreadedGenerateData()
RealType GetMaximum(LabelPixelType label) const
Statistics stored per label.
Superclass::RealType RealType
std::list< int > GetRelevantLabels() const
RealType GetUniformity(LabelPixelType label) const
itk::SmartPointer< Self > Pointer
RealType m_SumOfPositivePixels
IdentifierType MapSizeType
RealType GetMPP(LabelPixelType label) const
RealType GetUPP(LabelPixelType label) const
RealType GetVariance(LabelPixelType label) const
Extension of the itkLabelStatisticsImageFilter that also calculates the Skewness,Kurtosis,Entropy,Uniformity.
RealType m_SumOfQuadruples
RealType GetKurtosis(LabelPixelType label) const
void SetHistogramParametersForLabels(std::map< LabelPixelType, unsigned int > numBins, std::map< LabelPixelType, PixelType > lowerBound, std::map< LabelPixelType, PixelType > upperBound)
Superclass::RegionType RegionType
virtual ~ExtendedLabelStatisticsImageFilter()
Superclass::PixelType PixelType
Superclass::BoundingBoxType m_BoundingBox
RealType GetSigma(LabelPixelType label) const
RegionType GetRegion(LabelPixelType label) const
RealType GetMedian(LabelPixelType label) const
LabelStatistics & operator=(const LabelStatistics &l)
HistogramType::Pointer GetHistogram(LabelPixelType label) const
SmartPointer< const Self > ConstPointer
std::vector< LabelPixelType > ValidLabelValuesContainerType
void SetHistogramParameters(const int numBins, RealType lowerBound, RealType upperBound)
void BeforeThreadedGenerateData()
void ThreadedGenerateData(const typename TInputImage::RegionType &outputRegionForThread, ThreadIdType threadId)
RealType GetMinimum(LabelPixelType label) const
itk::Statistics::Histogram< double > HistogramType
SmartPointer< Self > Pointer
itk::BoundingBox< unsigned long, 3, mitk::ScalarType > BoundingBoxType
IdentifierType m_PositivePixelCount
ExtendedLabelStatisticsImageFilter Self
itksys::hash_map< LabelPixelType, LabelStatistics >::iterator StatisticsMapIterator
RealType GetSum(LabelPixelType label) const
Superclass::MapIterator MapIterator
bool GetMaskingNonEmpty() const
RealType GetEntropy(LabelPixelType label) const
RealType GetMean(LabelPixelType label) const
BoundingBoxType GetBoundingBox(LabelPixelType label) const
Superclass::LabelPixelType LabelPixelType
itksys::hash_map< LabelPixelType, LabelStatistics >::const_iterator StatisticsMapConstIterator
HistogramType::Pointer m_Histogram
RealType GetSkewness(LabelPixelType label) const
LabelStatistics(int size, RealType lowerBound, RealType upperBound)
bool HasLabel(LabelPixelType label) const
Superclass::BoundingBoxType BoundingBoxType
MapSizeType GetCount(LabelPixelType label) const
LabelStatistics(const LabelStatistics &l)
itksys::hash_map< LabelPixelType, LabelStatistics > MapType
ExtendedLabelStatisticsImageFilter()
LabelStatisticsImageFilter< TInputImage, TLabelImage > Superclass
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.