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

itkSpatialObjectToImageStatisticsCalculator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSpatialObjectToImageStatisticsCalculator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006-07-17 11:41:53 $
00007   Version:   $Revision: 1.9 $
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 __itkSpatialObjectToImageStatisticsCalculator_h
00018 #define __itkSpatialObjectToImageStatisticsCalculator_h
00019 
00020 #include "itkObject.h"
00021 #include "itkObjectFactory.h"
00022 #include "itkFloodFilledSpatialFunctionConditionalConstIterator.h"
00023 #include "itkMatrix.h"
00024 #include "itkNumericTraits.h"
00025 #include "itkListSample.h"
00026 #include "itkVector.h"
00027 
00028 namespace itk
00029 {
00030 
00035 template <class TInputImage, class TInputSpatialObject, unsigned int TSampleDimension=1>            
00036 class ITK_EXPORT SpatialObjectToImageStatisticsCalculator : public Object 
00037 {
00038 public:
00039 
00041   typedef SpatialObjectToImageStatisticsCalculator Self;
00042   typedef Object  Superclass;
00043   typedef SmartPointer<Self>   Pointer;
00044   typedef SmartPointer<const Self>  ConstPointer;
00045 
00047   itkNewMacro(Self);
00048 
00050   itkTypeMacro(SpatialObjectToImageStatisticsCalculator, Object);
00051 
00053   typedef TInputImage  ImageType;
00054   typedef typename TInputImage::Pointer  ImagePointer;
00055   typedef typename TInputImage::ConstPointer ImageConstPointer;
00056   typedef typename TInputImage::PixelType PixelType;
00057   typedef typename TInputImage::IndexType IndexType;
00058   typedef  typename NumericTraits< PixelType >::AccumulateType AccumulateType;
00059 
00060   itkStaticConstMacro(ImageDimension, unsigned int,
00061                       ImageType::ImageDimension);
00062   
00063   itkStaticConstMacro(SampleDimension, unsigned int,
00064                       TSampleDimension);
00065 
00066   itkStaticConstMacro(ObjectDimension, unsigned int,
00067                       TInputSpatialObject::ObjectDimension);
00068 
00069 
00071   typedef TInputSpatialObject SpatialObjectType;  
00072   typedef typename SpatialObjectType::Pointer  SpatialObjectPointer;
00073   typedef typename SpatialObjectType::ConstPointer SpatialObjectConstPointer;
00074 
00076   typedef itk::FloodFilledSpatialFunctionConditionalConstIterator<ImageType,
00077                                                  SpatialObjectType> IteratorType;
00078 
00080   typedef Vector< double, TSampleDimension> VectorType;
00081   typedef Matrix< double, TSampleDimension, TSampleDimension > MatrixType ;
00082 
00084   typedef itk::Statistics::ListSample< VectorType > SampleType;
00085 
00087   itkSetMacro(SampleDirection,unsigned int);
00088   itkGetMacro(SampleDirection,unsigned int);
00090 
00092   itkSetConstObjectMacro(Image,ImageType);
00093 
00095   itkSetObjectMacro(SpatialObject,SpatialObjectType);
00096 
00098   const VectorType & GetMean() const {return m_Mean;}
00099 
00101   const MatrixType & GetCovarianceMatrix() const {return m_CovarianceMatrix;}
00102 
00104   AccumulateType GetSum() const {return m_Sum;}
00105 
00107   itkGetConstMacro(NumberOfPixels,unsigned long);
00108 
00110   void Update(void);
00111 
00112 protected:
00113   SpatialObjectToImageStatisticsCalculator();
00114   virtual ~SpatialObjectToImageStatisticsCalculator() {};
00115   void PrintSelf(std::ostream& os, Indent indent) const;
00116 
00117   bool ComputeStatistics();
00118 
00119 private:
00120   SpatialObjectToImageStatisticsCalculator(const Self&); //purposely not implemented
00121   void operator=(const Self&); //purposely not implemented
00122   
00123   ImageConstPointer            m_Image;
00124   SpatialObjectPointer         m_SpatialObject;
00125   VectorType                   m_Mean;
00126   AccumulateType               m_Sum;
00127   unsigned long                m_NumberOfPixels;
00128   MatrixType                   m_CovarianceMatrix;
00129   unsigned int                 m_SampleDirection;
00130   unsigned long                m_InternalImageTime;
00131   unsigned long                m_InternalSpatialObjectTime;
00132   TimeStamp                    m_ModifiedTime;
00133   typename SampleType::Pointer m_Sample;
00134 };
00135 
00136 } // end namespace itk
00137 
00138 
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkSpatialObjectToImageStatisticsCalculator.txx"
00141 #endif
00142 
00143 #endif /* __itkSpatialObjectToImageStatisticsCalculator_h */
00144 

Generated at Mon Apr 14 14:29:58 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000