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

itkGaussianDensityFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGaussianDensityFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2003/09/10 14:29:45 $
00007   Version:   $Revision: 1.12 $
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 __itkGaussianDensityFunction_h
00018 #define __itkGaussianDensityFunction_h
00019 
00020 #include "vnl/vnl_vector.h"
00021 #include "vnl/vnl_matrix.h"
00022 #include "vnl/algo/vnl_matrix_inverse.h"
00023 #include "vnl/algo/vnl_determinant.h"
00024 #include "vnl/vnl_math.h"
00025 
00026 #include "itkMatrix.h"
00027 #include "itkDensityFunction.h"
00028 
00029 namespace itk{ 
00030 namespace Statistics{
00031 
00045 template< class TMeasurementVector >
00046 class ITK_EXPORT GaussianDensityFunction :
00047     public DensityFunction< TMeasurementVector >
00048 {
00049 public:
00051   typedef GaussianDensityFunction Self;
00052   typedef DensityFunction< TMeasurementVector > Superclass ;
00053   typedef SmartPointer<Self> Pointer;
00054 
00056   itkTypeMacro(GaussianDensityFunction, DensityFunction);
00057   itkNewMacro(Self);
00058   
00060   typedef TMeasurementVector MeasurementVectorType ;
00061 
00063   itkStaticConstMacro(VectorDimension, unsigned int,
00064                       TMeasurementVector::Length);
00065 
00067   typedef Vector< double, itkGetStaticConstMacro(VectorDimension) > MeanType ;
00068   
00070   typedef Matrix< double, itkGetStaticConstMacro(VectorDimension), 
00071                   itkGetStaticConstMacro(VectorDimension) > CovarianceType ;
00072 
00074   void SetMean(MeanType* mean)
00075   {
00076     if ( m_Mean != mean) 
00077       {
00078       m_Mean = mean ;
00079       this->Modified() ;
00080       }
00081   }
00082   
00084   MeanType* GetMean() const
00085   { return m_Mean ; }
00086 
00090   void SetCovariance(CovarianceType* cov); 
00091   
00093   CovarianceType* GetCovariance() const ;
00094 
00096   double Evaluate(const MeasurementVectorType &measurement) const ;
00097   
00098 protected:
00099   GaussianDensityFunction(void) ;
00100   virtual ~GaussianDensityFunction(void) {}
00101   void PrintSelf(std::ostream& os, Indent indent) const;
00102 
00103 private:
00104   MeanType* m_Mean;              // mean
00105   CovarianceType* m_Covariance;         // covariance matrix
00106 
00107   // inverse covariance matrix which is automatically calculated 
00108   // when covariace matirx is set.  This speed up the GetProbability()
00109   CovarianceType  m_InverseCovariance; 
00110 
00111   // pre_factor which is automatically calculated 
00112   // when covariace matirx is set.  This speeds up the GetProbability()  
00113   double m_PreFactor;
00114 
00117   bool m_IsCovarianceZero ;
00118 };
00119 
00120 } // end of namespace Statistics
00121 } // end namespace itk
00122 
00123 #ifndef ITK_MANUAL_INSTANTIATION
00124 #include "itkGaussianDensityFunction.txx"
00125 #endif
00126 
00127 #endif

Generated at Tue Sep 16 11:31:59 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000