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: 2005/06/15 15:04:07 $
00007   Version:   $Revision: 1.13 $
00008 
00009   Copyright (c) Insight Software 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 #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   typedef SimpleDataObjectDecorator<PixelType> PixelObjectType;
00081   
00083   PixelType GetMinimum() const
00084     { return this->GetMinimumOutput()->Get(); }
00085   PixelObjectType* GetMinimumOutput();
00086   const PixelObjectType* GetMinimumOutput() const;
00087   
00089   PixelType GetMaximum() const
00090     { return this->GetMaximumOutput()->Get(); }
00091   PixelObjectType* GetMaximumOutput();
00092   const PixelObjectType* GetMaximumOutput() const;
00093 
00095   RealType GetMean() const
00096     { return this->GetMeanOutput()->Get(); }
00097   RealObjectType* GetMeanOutput();
00098   const RealObjectType* GetMeanOutput() const;
00099 
00101   RealType GetSigma() const
00102     { return this->GetSigmaOutput()->Get(); }
00103   RealObjectType* GetSigmaOutput();
00104   const RealObjectType* GetSigmaOutput() const;
00105 
00107   RealType GetVariance() const
00108     { return this->GetVarianceOutput()->Get(); }
00109   RealObjectType* GetVarianceOutput();
00110   const RealObjectType* GetVarianceOutput() const;
00111 
00113   RealType GetSum() const
00114     { return this->GetSumOutput()->Get(); }
00115   RealObjectType* GetSumOutput();
00116   const RealObjectType* GetSumOutput() const;
00117 
00120   virtual DataObjectPointer MakeOutput(unsigned int idx);
00121 
00122 protected:
00123   StatisticsImageFilter();
00124   ~StatisticsImageFilter(){};
00125   void PrintSelf(std::ostream& os, Indent indent) const;
00126 
00128   void AllocateOutputs();      
00129 
00131   void BeforeThreadedGenerateData ();
00132   
00134   void AfterThreadedGenerateData ();
00135   
00137   void  ThreadedGenerateData (const RegionType& 
00138                               outputRegionForThread,
00139                               int threadId) ;
00140 
00141   // Override since the filter needs all the data for the algorithm
00142   void GenerateInputRequestedRegion();
00143 
00144   // Override since the filter produces all of its output
00145   void EnlargeOutputRequestedRegion(DataObject *data);
00146 
00147 private:
00148   StatisticsImageFilter(const Self&); //purposely not implemented
00149   void operator=(const Self&); //purposely not implemented
00150 
00151   Array<RealType>  m_ThreadSum;
00152   Array<RealType>  m_SumOfSquares;
00153   Array<long>      m_Count;
00154   Array<PixelType> m_ThreadMin;
00155   Array<PixelType> m_ThreadMax;
00156 
00157 } ; // end of class
00158 
00159 } // end namespace itk
00160   
00161 #ifndef ITK_MANUAL_INSTANTIATION
00162 #include "itkStatisticsImageFilter.txx"
00163 #endif
00164 
00165 #endif

Generated at Thu May 25 00:07:00 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000