Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkExtendedStatisticsImageFilter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef __mitkExtendedStatisticsImageFilter
17 #define __mitkExtendedStatisticsImageFilter
18 
19 #include "itkStatisticsImageFilter.h"
20 #include <mbilog.h>
21 #include <mitkLogMacros.h>
22 
23 namespace itk
24 {
37  template< class TInputImage >
38  class ExtendedStatisticsImageFilter : public StatisticsImageFilter< TInputImage >
39  {
40  public:
43  typedef StatisticsImageFilter< TInputImage > Superclass;
46  typedef typename Superclass::RealType RealType;
47  typedef typename Superclass::RealObjectType RealObjectType;
48  typedef typename Superclass::PixelType PixelType;
49 
51  typedef itk::Statistics::Histogram< RealType > HistogramType;
53 
54  itkFactorylessNewMacro( Self );
55  itkCloneMacro( Self );
56  itkTypeMacro( ExtendedStatisticsImageFilter, StatisticsImageFilter );
57 
61  double GetSkewness() const
62  {
63  return this->GetSkewnessOutput()->Get();
64  }
65 
69  double GetMedian() const
70  {
71  return this->GetMedianOutput()->Get();
72  }
73 
77  double GetKurtosis() const
78  {
79  return this->GetKurtosisOutput()->Get();
80  }
81 
82  /* \brief Return the computed MPP.
83  */
84  double GetMPP() const
85  {
86  return this->GetMPPOutput()->Get();
87  }
88 
92  double GetUniformity() const
93  {
94  return this->GetUniformityOutput()->Get();
95  }
96 
100  double GetEntropy() const
101  {
102  return this->GetEntropyOutput()->Get();
103  }
104 
108  double GetUPP() const
109  {
110  return this->GetUPPOutput()->Get();
111  }
112 
113 
117  const typename HistogramType::Pointer
119  {
120  if (m_HistogramCalculated)
121  {
122  return m_Histogram;
123  }
124  else
125  {
126  return ITK_NULLPTR;
127  }
128  }
129 
130 
132  void SetHistogramParameters(const int numBins, RealType lowerBound,
133  RealType upperBound);
134 
135  protected:
136 
138 
140 
142 
144  void ThreadedGenerateData(const typename StatisticsImageFilter<TInputImage>::RegionType &
145  outputRegionForThread,
146  ThreadIdType threadId);
147 
152 
153 
154  RealObjectType* GetSkewnessOutput();
155 
156  const RealObjectType* GetSkewnessOutput() const;
157 
158  RealObjectType* GetKurtosisOutput();
159 
160  const RealObjectType* GetKurtosisOutput() const;
161 
162  RealObjectType* GetMPPOutput();
163 
164  const RealObjectType* GetMPPOutput() const;
165 
166  RealObjectType* GetEntropyOutput();
167 
168  const RealObjectType* GetEntropyOutput() const;
169 
170  RealObjectType* GetUniformityOutput();
171 
172  const RealObjectType* GetUniformityOutput() const;
173 
174  RealObjectType* GetUPPOutput();
175 
176  const RealObjectType* GetUPPOutput() const;
177 
178  RealObjectType* GetMedianOutput();
179 
180  const RealObjectType* GetMedianOutput() const;
181 
182  virtual DataObject::Pointer MakeOutput( ProcessObject::DataObjectPointerArraySizeType idx );
183 
184 private:
185  Array< RealType > m_ThreadSum;
186  Array< RealType > m_SumOfSquares;
187  Array< RealType > m_SumOfCubes;
188  Array< RealType > m_SumOfQuadruples;
189  Array< SizeValueType > m_Count;
190  Array< SizeValueType > m_PositivePixelCount;
191  Array< RealType > m_ThreadSumOfPositivePixels;
192  Array< PixelType > m_ThreadMin;
193  Array< PixelType > m_ThreadMax;
194  std::vector< HistogramPointer > m_HistogramPerThread;
195  HistogramPointer m_Histogram;
196  bool m_UseHistogram;
197  bool m_HistogramCalculated;
198  RealType m_LowerBound, m_UpperBound;
199  int m_NumBins;
200 
201 
202  }; // end of class
203 
204 } // end namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 #include "mitkExtendedStatisticsImageFilter.hxx"
208 #endif
209 
210 #endif
RealObjectType * GetMedianOutput()
itk::SmartPointer< Self > Pointer
double GetUPP() const
Return the computed UPP.
double GetEntropy() const
Return the computed Entropy.
const HistogramType::Pointer GetHistogram()
Return the computed Histogram.
double GetUniformity() const
Return the computed Uniformity.
RealObjectType * GetEntropyOutput()
RealObjectType * GetSkewnessOutput()
RealObjectType * GetUniformityOutput()
void SetHistogramParameters(const int numBins, RealType lowerBound, RealType upperBound)
void ThreadedGenerateData(const typename StatisticsImageFilter< TInputImage >::RegionType &outputRegionForThread, ThreadIdType threadId)
double GetMedian() const
Return the computed Median.
RealObjectType * GetKurtosisOutput()
virtual DataObject::Pointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx)
itk::Statistics::Histogram< RealType > HistogramType
Extension of the itkStatisticsImageFilter that also calculates the Skewness and Kurtosis.
double GetKurtosis() const
Return the computed Kurtosis.
unsigned short PixelType
StatisticsImageFilter< TInputImage > Superclass
double GetSkewness() const
Return the computed Skewness.