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: 2007-01-28 18:49:10 $
00007   Version:   $Revision: 1.15 $
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;
00088 
00090   PixelType GetMaximum() const
00091     { return this->GetMaximumOutput()->Get(); }
00092   PixelObjectType* GetMaximumOutput();
00093   const PixelObjectType* GetMaximumOutput() const;
00095 
00097   RealType GetMean() const
00098     { return this->GetMeanOutput()->Get(); }
00099   RealObjectType* GetMeanOutput();
00100   const RealObjectType* GetMeanOutput() const;
00102 
00104   RealType GetSigma() const
00105     { return this->GetSigmaOutput()->Get(); }
00106   RealObjectType* GetSigmaOutput();
00107   const RealObjectType* GetSigmaOutput() const;
00109 
00111   RealType GetVariance() const
00112     { return this->GetVarianceOutput()->Get(); }
00113   RealObjectType* GetVarianceOutput();
00114   const RealObjectType* GetVarianceOutput() const;
00116 
00118   RealType GetSum() const
00119     { return this->GetSumOutput()->Get(); }
00120   RealObjectType* GetSumOutput();
00121   const RealObjectType* GetSumOutput() const;
00123 
00126   virtual DataObjectPointer MakeOutput(unsigned int idx);
00127 
00128 #ifdef ITK_USE_CONCEPT_CHECKING
00129 
00130   itkConceptMacro(InputHasNumericTraitsCheck,
00131                   (Concept::HasNumericTraits<PixelType>));
00132 
00134 #endif
00135 
00136 protected:
00137   StatisticsImageFilter();
00138   ~StatisticsImageFilter(){};
00139   void PrintSelf(std::ostream& os, Indent indent) const;
00140 
00144   void AllocateOutputs();
00145 
00147   void BeforeThreadedGenerateData ();
00148 
00151   void AfterThreadedGenerateData ();
00152 
00154   void  ThreadedGenerateData (const RegionType&
00155                               outputRegionForThread,
00156                               int threadId);
00157 
00158   // Override since the filter needs all the data for the algorithm
00159   void GenerateInputRequestedRegion();
00160 
00161   // Override since the filter produces all of its output
00162   void EnlargeOutputRequestedRegion(DataObject *data);
00163 
00164 private:
00165   StatisticsImageFilter(const Self&); //purposely not implemented
00166   void operator=(const Self&); //purposely not implemented
00167 
00168   Array<RealType>  m_ThreadSum;
00169   Array<RealType>  m_SumOfSquares;
00170   Array<long>      m_Count;
00171   Array<PixelType> m_ThreadMin;
00172   Array<PixelType> m_ThreadMax;
00173 
00174 }; // end of class
00175 
00176 } // end namespace itk
00177 
00178 #ifndef ITK_MANUAL_INSTANTIATION
00179 #include "itkStatisticsImageFilter.txx"
00180 #endif
00181 
00182 #endif
00183 

Generated at Mon Jul 12 2010 19:58:00 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000