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: 2009-04-25 12:28:11 $
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 __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 
00036 template <class TInputImage, class TInputSpatialObject, unsigned int TSampleDimension=1>
00037 class ITK_EXPORT SpatialObjectToImageStatisticsCalculator : public Object 
00038 {
00039 public:
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 
00059   typedef  typename NumericTraits< PixelType >::AccumulateType AccumulateType;
00060 
00061   itkStaticConstMacro(ImageDimension, unsigned int,
00062                       ImageType::ImageDimension);
00063   
00064   itkStaticConstMacro(SampleDimension, unsigned int,
00065                       TSampleDimension);
00066 
00067   itkStaticConstMacro(ObjectDimension, unsigned int,
00068                       TInputSpatialObject::ObjectDimension);
00069 
00070 
00072   typedef TInputSpatialObject SpatialObjectType;  
00073   typedef typename SpatialObjectType::Pointer  SpatialObjectPointer;
00074   typedef typename SpatialObjectType::ConstPointer SpatialObjectConstPointer;
00075 
00077   typedef itk::FloodFilledSpatialFunctionConditionalConstIterator<ImageType,
00078                                                  SpatialObjectType> IteratorType;
00079 
00081   typedef Vector< double, TSampleDimension>                    VectorType;
00082   typedef Matrix< double, TSampleDimension, TSampleDimension > MatrixType;
00083 
00085   typedef itk::Statistics::ListSample< VectorType > SampleType;
00086 
00088   itkSetMacro(SampleDirection,unsigned int);
00089   itkGetConstMacro(SampleDirection,unsigned int);
00091 
00093   itkSetConstObjectMacro(Image,ImageType);
00094 
00096   itkSetObjectMacro(SpatialObject,SpatialObjectType);
00097 
00099   const VectorType & GetMean() const {return m_Mean;}
00100 
00102   const MatrixType & GetCovarianceMatrix() const {return m_CovarianceMatrix;}
00103 
00105   AccumulateType GetSum() const {return m_Sum;}
00106 
00108   itkGetConstMacro(NumberOfPixels,unsigned long);
00109 
00111   void Update(void);
00112 
00113 protected:
00114   SpatialObjectToImageStatisticsCalculator();
00115   virtual ~SpatialObjectToImageStatisticsCalculator() {};
00116   void PrintSelf(std::ostream& os, Indent indent) const;
00117 
00118   bool ComputeStatistics();
00119 
00120 private:
00121   SpatialObjectToImageStatisticsCalculator(const Self&); //purposely not implemented
00122   void operator=(const Self&); //purposely not implemented
00123   
00124   ImageConstPointer            m_Image;
00125   SpatialObjectPointer         m_SpatialObject;
00126   VectorType                   m_Mean;
00127   AccumulateType               m_Sum;
00128   unsigned long                m_NumberOfPixels;
00129   MatrixType                   m_CovarianceMatrix;
00130   unsigned int                 m_SampleDirection;
00131   unsigned long                m_InternalImageTime;
00132   unsigned long                m_InternalSpatialObjectTime;
00133   TimeStamp                    m_ModifiedTime;
00134   typename SampleType::Pointer m_Sample;
00135 };
00136 
00137 } // end namespace itk
00138 
00139 
00140 #ifndef ITK_MANUAL_INSTANTIATION
00141 #include "itkSpatialObjectToImageStatisticsCalculator.txx"
00142 #endif
00143 
00144 #endif /* __itkSpatialObjectToImageStatisticsCalculator_h */
00145 

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