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: 2004/03/05 21:17:01 $
00007   Version:   $Revision: 1.11 $
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   
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   // Override since the filter needs all the data for the algorithm
00141   void GenerateInputRequestedRegion();
00142 
00143   // Override since the filter produces all of its output
00144   void EnlargeOutputRequestedRegion(DataObject *data);
00145 
00146 private:
00147   StatisticsImageFilter(const Self&); //purposely not implemented
00148   void operator=(const Self&); //purposely not implemented
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 } ; // end of class
00157 
00158 } // end namespace itk
00159   
00160 #ifndef ITK_MANUAL_INSTANTIATION
00161 #include "itkStatisticsImageFilter.txx"
00162 #endif
00163 
00164 #endif

Generated at Wed Mar 30 00:12:17 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000