00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkStatisticsImageFilter_h
00018
#define __itkStatisticsImageFilter_h
00019
00020
#include "itkImageToImageFilter.h"
00021
#include "itkNumericTraits.h"
00022
#include "itkArray.h"
00023
00024
namespace itk {
00025
00041
template<
class TInputImage>
00042 class ITK_EXPORT StatisticsImageFilter :
00043
public ImageToImageFilter<TInputImage, TInputImage>
00044 {
00045
public:
00047 typedef StatisticsImageFilter
Self;
00048 typedef ImageToImageFilter<TInputImage,TInputImage> Superclass;
00049 typedef SmartPointer<Self> Pointer;
00050 typedef SmartPointer<const Self> ConstPointer;
00051
00053
itkNewMacro(
Self);
00054
00056
itkTypeMacro(StatisticsImageFilter,
ImageToImageFilter);
00057
00059 typedef typename TInputImage::Pointer
InputImagePointer;
00060
00061 typedef typename TInputImage::RegionType
RegionType ;
00062 typedef typename TInputImage::SizeType
SizeType ;
00063 typedef typename TInputImage::IndexType
IndexType ;
00064 typedef typename TInputImage::PixelType
PixelType ;
00065
00067
itkStaticConstMacro(ImageDimension,
unsigned int,
00068 TInputImage::ImageDimension ) ;
00069
00071 typedef typename NumericTraits<PixelType>::RealType RealType;
00072
00074
itkGetMacro(Minimum,
RealType);
00075
00077
itkGetMacro(Maximum,
RealType);
00078
00080
itkGetMacro(Mean,
RealType);
00081
00083
itkGetMacro(Sigma,
RealType);
00084
00086
itkGetMacro(Variance,
RealType);
00087
00089
itkGetMacro(Sum,
RealType);
00090
00091
protected:
00092 StatisticsImageFilter(): m_ThreadSum(1), m_SumOfSquares(1), m_Count(1), m_ThreadMin(1), m_ThreadMax(1)
00093 {
00094 m_Minimum =
NumericTraits<RealType>::max();
00095 m_Maximum =
NumericTraits<RealType>::NonpositiveMin();
00096 m_Mean =
NumericTraits<RealType>::max();
00097 m_Sigma =
NumericTraits<RealType>::max();
00098 m_Variance =
NumericTraits<RealType>::max();
00099 m_Sum =
NumericTraits<RealType>::Zero;
00100 };
00101
00102 ~StatisticsImageFilter(){};
00103
void PrintSelf(std::ostream& os,
Indent indent)
const;
00104
00106
void AllocateOutputs();
00107
00109
void BeforeThreadedGenerateData ();
00110
00112
void AfterThreadedGenerateData ();
00113
00115
void ThreadedGenerateData (
const RegionType&
00116 outputRegionForThread,
00117
int threadId) ;
00118
00119
00120
void GenerateInputRequestedRegion();
00121
00122
00123
void EnlargeOutputRequestedRegion(
DataObject *data);
00124
00125
private:
00126 StatisticsImageFilter(
const Self&);
00127
void operator=(
const Self&);
00128
00129 RealType m_Minimum;
00130 RealType m_Maximum;
00131 RealType m_Mean;
00132 RealType m_Sigma;
00133 RealType m_Variance;
00134 RealType m_Sum;
00135
00136
Array<RealType> m_ThreadSum;
00137
Array<RealType> m_SumOfSquares;
00138
Array<long> m_Count;
00139
Array<RealType> m_ThreadMin;
00140
Array<RealType> m_ThreadMax;
00141
00142 } ;
00143
00144 }
00145
00146
#ifndef ITK_MANUAL_INSTANTIATION
00147
#include "itkStatisticsImageFilter.txx"
00148
#endif
00149
00150
#endif