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 #include "itkSimpleDataObjectDecorator.h"
00024
00025
00026 namespace itk {
00027
00043 template<class TInputImage>
00044 class ITK_EXPORT StatisticsImageFilter :
00045 public ImageToImageFilter<TInputImage, TInputImage>
00046 {
00047 public:
00049 typedef StatisticsImageFilter Self;
00050 typedef ImageToImageFilter<TInputImage,TInputImage> Superclass;
00051 typedef SmartPointer<Self> Pointer;
00052 typedef SmartPointer<const Self> ConstPointer;
00053
00055 itkNewMacro(Self);
00056
00058 itkTypeMacro(StatisticsImageFilter, ImageToImageFilter);
00059
00061 typedef typename TInputImage::Pointer InputImagePointer;
00062
00063 typedef typename TInputImage::RegionType RegionType ;
00064 typedef typename TInputImage::SizeType SizeType ;
00065 typedef typename TInputImage::IndexType IndexType ;
00066 typedef typename TInputImage::PixelType PixelType ;
00067
00069 itkStaticConstMacro(ImageDimension, unsigned int,
00070 TInputImage::ImageDimension ) ;
00071
00073 typedef typename NumericTraits<PixelType>::RealType RealType;
00074
00076 typedef typename DataObject::Pointer DataObjectPointer;
00077
00079 typedef SimpleDataObjectDecorator<RealType> RealObjectType;
00080
00082 RealType GetMinimum() const
00083 { return this->GetMinimumOutput()->Get(); }
00084 RealObjectType* GetMinimumOutput();
00085 const RealObjectType* GetMinimumOutput() const;
00086
00088 RealType GetMaximum() const
00089 { return this->GetMaximumOutput()->Get(); }
00090 RealObjectType* GetMaximumOutput();
00091 const RealObjectType* GetMaximumOutput() const;
00092
00094 RealType GetMean() const
00095 { return this->GetMeanOutput()->Get(); }
00096 RealObjectType* GetMeanOutput();
00097 const RealObjectType* GetMeanOutput() const;
00098
00100 RealType GetSigma() const
00101 { return this->GetSigmaOutput()->Get(); }
00102 RealObjectType* GetSigmaOutput();
00103 const RealObjectType* GetSigmaOutput() const;
00104
00106 RealType GetVariance() const
00107 { return this->GetVarianceOutput()->Get(); }
00108 RealObjectType* GetVarianceOutput();
00109 const RealObjectType* GetVarianceOutput() const;
00110
00112 RealType GetSum() const
00113 { return this->GetSumOutput()->Get(); }
00114 RealObjectType* GetSumOutput();
00115 const RealObjectType* GetSumOutput() const;
00116
00119 virtual DataObjectPointer MakeOutput(unsigned int idx);
00120
00121 protected:
00122 StatisticsImageFilter();
00123 ~StatisticsImageFilter(){};
00124 void PrintSelf(std::ostream& os, Indent indent) const;
00125
00127 void AllocateOutputs();
00128
00130 void BeforeThreadedGenerateData ();
00131
00133 void AfterThreadedGenerateData ();
00134
00136 void ThreadedGenerateData (const RegionType&
00137 outputRegionForThread,
00138 int threadId) ;
00139
00140
00141 void GenerateInputRequestedRegion();
00142
00143
00144 void EnlargeOutputRequestedRegion(DataObject *data);
00145
00146 private:
00147 StatisticsImageFilter(const Self&);
00148 void operator=(const Self&);
00149
00150 Array<RealType> m_ThreadSum;
00151 Array<RealType> m_SumOfSquares;
00152 Array<long> m_Count;
00153 Array<RealType> m_ThreadMin;
00154 Array<RealType> m_ThreadMax;
00155
00156 } ;
00157
00158 }
00159
00160 #ifndef ITK_MANUAL_INSTANTIATION
00161 #include "itkStatisticsImageFilter.txx"
00162 #endif
00163
00164 #endif