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/12/15 01:00:46 $
00007   Version:   $Revision: 1.14 $
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   typedef SmartPointer<const Self> ConstPointer;
00055 
00057   itkTypeMacro(GaussianDensityFunction, DensityFunction);
00058   itkNewMacro(Self);
00059   
00061   typedef TMeasurementVector MeasurementVectorType ;
00062 
00064   itkStaticConstMacro(VectorDimension, unsigned int,
00065                       TMeasurementVector::Length);
00066 
00068   typedef Vector< double, itkGetStaticConstMacro(VectorDimension) > MeanType ;
00069   
00071   typedef Matrix< double, itkGetStaticConstMacro(VectorDimension), 
00072                   itkGetStaticConstMacro(VectorDimension) > CovarianceType ;
00073 
00075   void SetMean( const MeanType * mean )
00076   {
00077     if ( m_Mean != mean) 
00078       {
00079       m_Mean = mean ;
00080       this->Modified() ;
00081       }
00082   }
00083   
00085   const MeanType * GetMean() const
00086   { return m_Mean ; }
00087 
00091   void SetCovariance(const CovarianceType* cov); 
00092   
00094   const CovarianceType* GetCovariance() const ;
00095 
00097   double Evaluate(const MeasurementVectorType &measurement) const ;
00098   
00099 protected:
00100   GaussianDensityFunction(void) ;
00101   virtual ~GaussianDensityFunction(void) {}
00102   void PrintSelf(std::ostream& os, Indent indent) const;
00103 
00104 private:
00105   const MeanType        * m_Mean;           // mean
00106   const CovarianceType  * m_Covariance;     // covariance matrix
00107 
00108   // inverse covariance matrix which is automatically calculated 
00109   // when covariace matirx is set.  This speed up the GetProbability()
00110   CovarianceType  m_InverseCovariance; 
00111 
00112   // pre_factor which is automatically calculated 
00113   // when covariace matirx is set.  This speeds up the GetProbability()  
00114   double m_PreFactor;
00115 
00118   bool m_IsCovarianceZero ;
00119 };
00120 
00121 } // end of namespace Statistics
00122 } // end namespace itk
00123 
00124 #ifndef ITK_MANUAL_INSTANTIATION
00125 #include "itkGaussianDensityFunction.txx"
00126 #endif
00127 
00128 #endif

Generated at Tue Mar 29 23:52:07 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000