Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkStatisticsImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkStatisticsImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/11 19:39:03 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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   // Override since the filter needs all the data for the algorithm
00120   void GenerateInputRequestedRegion();
00121 
00122   // Override since the filter produces all of its output
00123   void EnlargeOutputRequestedRegion(DataObject *data);
00124 
00125  private:
00126   StatisticsImageFilter(const Self&); //purposely not implemented
00127   void operator=(const Self&); //purposely not implemented
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 } ; // end of class
00143 
00144 } // end namespace itk
00145   
00146 #ifndef ITK_MANUAL_INSTANTIATION
00147 #include "itkStatisticsImageFilter.txx"
00148 #endif
00149 
00150 #endif

Generated at Fri May 21 01:15:21 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000