00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGaussianGoodnessOfFitComponent.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/30 15:24:41 $ 00007 Version: $Revision: 1.5 $ 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 __itkGaussianGoodnessOfFitComponent_h 00018 #define __itkGaussianGoodnessOfFitComponent_h 00019 00020 #include "itkGoodnessOfFitComponentBase.h" 00021 #include "itkGaussianDensityFunction.h" 00022 #include "itkFunctionBase.h" 00023 #include "itkWeightedCovarianceCalculator.h" 00024 #include "itkSymmetricEigenSystem.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00044 template< class TInputSample > 00045 class GaussianGoodnessOfFitComponent 00046 : public GoodnessOfFitComponentBase< TInputSample > 00047 { 00048 public: 00050 typedef GaussianGoodnessOfFitComponent Self; 00051 typedef GoodnessOfFitComponentBase< TInputSample > Superclass; 00052 typedef SmartPointer< Self > Pointer; 00053 typedef SmartPointer< const Self > ConstPointer; 00054 00056 itkTypeMacro(GaussianGoodnessOfFitComponent, 00057 GoodnessOfFitComponentBase) ; 00058 00060 itkNewMacro(Self) ; 00061 00063 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00064 TInputSample::MeasurementVectorSize) ; 00065 typedef typename TInputSample::MeasurementType MeasurementType ; 00066 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ; 00067 00069 typedef typename Superclass::CenterType CenterType ; 00070 typedef typename Superclass::RadiusType RadiusType ; 00071 typedef typename Superclass::MeanType MeanType ; 00072 typedef typename Superclass::StandardDeviationType StandardDeviationType ; 00073 typedef typename Superclass::ResampledSampleType ResampledSampleType ; 00074 typedef typename Superclass::ProjectionAxisArrayType ProjectionAxisArrayType; 00075 typedef Array< double > ParametersType ; 00076 00079 typedef GaussianDensityFunction< MeasurementVectorType > 00080 ProbabilityDensityFunctionType ; 00081 00082 typedef typename ProbabilityDensityFunctionType::CovarianceType CovarianceType ; 00083 00087 typedef WeightedCovarianceCalculator< ResampledSampleType > 00088 CovarianceCalculatorType ; 00089 00091 typedef SymmetricEigenSystem< double, itkGetStaticConstMacro(MeasurementVectorSize) > 00092 ProjectionAxisCalculatorType ; 00093 00096 unsigned int GetNumberOfParameters() const 00097 { return (unsigned int)(itkGetStaticConstMacro(MeasurementVectorSize) + 1) ; } 00098 00100 void SetParameters(const ParametersType ¶meter) ; 00101 00102 CenterType* GetCenter() ; 00103 00104 RadiusType* GetRadius() ; 00105 00106 MeanType* GetMean() ; 00107 00108 StandardDeviationType* GetStandardDeviation() ; 00109 00111 double GetCumulativeProbability(double x) const ; 00112 00114 double GetProbabilityDensity(MeasurementVectorType &measurements) const ; 00115 00116 void PrintParameters(std::ostream &os) const ; 00117 00120 ParametersType GetFullParameters() const ; 00121 00122 protected: 00123 GaussianGoodnessOfFitComponent() ; 00124 virtual ~GaussianGoodnessOfFitComponent() ; 00125 00127 virtual void CalculateProjectionAxes() ; 00128 00129 private: 00130 typename ProbabilityDensityFunctionType::Pointer m_ProbabilityDensityFunction ; 00131 00132 typename CovarianceCalculatorType::Pointer m_CovarianceCalculator ; 00133 00134 typename ProjectionAxisCalculatorType::Pointer m_ProjectionAxisCalculator ; 00135 00136 MeanType m_Mean ; 00137 CenterType m_Center ; 00138 RadiusType m_Radius ; 00139 StandardDeviationType m_StandardDeviation ; 00140 CovarianceType m_Covariance ; 00141 00142 unsigned int m_NumberOfParameters ; 00143 00144 int m_LongestAxisIndex ; 00145 double m_LargestEigenValue ; 00146 } ; // end of class 00147 00148 } // end of namespace Statistics 00149 } // end of namespace itk 00150 00151 #ifndef ITK_MANUAL_INSTANTIATION 00152 #include "itkGaussianGoodnessOfFitComponent.txx" 00153 #endif 00154 00155 #endif 00156