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: 2002/09/23 20:28:33 $
00007 Version:   $Revision: 1.10 $
00008 
00009 Copyright (c) 2002 Insight 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 
00066   typedef Vector< double, itkGetStaticConstMacro(VectorDimension) > MeanType ;
00067   typedef Matrix< double, itkGetStaticConstMacro(VectorDimension), itkGetStaticConstMacro(VectorDimension) > CovarianceType ;
00068 
00070   void SetMean(MeanType* mean)
00071   {
00072     if ( m_Mean != mean) 
00073       {
00074         m_Mean = mean ;
00075         this->Modified() ;
00076       }
00077   }
00078   
00080   MeanType* GetMean() const
00081   { return m_Mean ; }
00082 
00086   void SetCovariance(CovarianceType* cov); 
00087   
00089   CovarianceType* GetCovariance() const ;
00090 
00093   double Evaluate(const MeasurementVectorType &measurement) const ;
00094   
00095 protected:
00096   GaussianDensityFunction(void) ;
00097   virtual ~GaussianDensityFunction(void) {}
00098   void PrintSelf(std::ostream& os, Indent indent) const;
00099 
00100 private:
00101   MeanType* m_Mean;              // mean
00102   CovarianceType* m_Covariance;         // covariance matrix
00103 
00104   // inverse covariance matrix which is automatically calculated 
00105   // when covariace matirx is set.  This speed up the GetProbability()
00106   CovarianceType  m_InverseCovariance; 
00107 
00108   // pre_factor which is automatically calculated 
00109   // when covariace matirx is set.  This speeds up the GetProbability()  
00110   double m_PreFactor;
00111 
00114   bool m_IsCovarianceZero ;
00115 };
00116 
00117 } // end of namespace Statistics
00118 } // end namespace itk
00119 
00120 #ifndef ITK_MANUAL_INSTANTIATION
00121 #include "itkGaussianDensityFunction.txx"
00122 #endif
00123 
00124 #endif

Generated at Wed Mar 12 01:12:57 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000