00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGaussianGoodnessOfFitComponent.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/07/26 15:54:55 $ 00007 Version: $Revision: 1.9 $ 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 __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 "itkSymmetricEigenAnalysis.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00050 template< class TInputSample > 00051 class GaussianGoodnessOfFitComponent 00052 : public GoodnessOfFitComponentBase< TInputSample > 00053 { 00054 public: 00056 typedef GaussianGoodnessOfFitComponent Self; 00057 typedef GoodnessOfFitComponentBase< TInputSample > Superclass; 00058 typedef SmartPointer< Self > Pointer; 00059 typedef SmartPointer< const Self > ConstPointer; 00060 00062 itkTypeMacro(GaussianGoodnessOfFitComponent, 00063 GoodnessOfFitComponentBase) ; 00064 00066 itkNewMacro(Self) ; 00067 00068 00070 typedef typename TInputSample::MeasurementType MeasurementType ; 00071 typedef typename TInputSample::MeasurementVectorType MeasurementVectorType ; 00072 00074 typedef typename Superclass::CenterType CenterType ; 00075 typedef typename Superclass::RadiusType RadiusType ; 00076 typedef typename Superclass::MeanType MeanType ; 00077 typedef typename Superclass::StandardDeviationType StandardDeviationType ; 00078 typedef typename Superclass::ResampledSampleType ResampledSampleType ; 00079 typedef typename Superclass::ProjectionAxisArrayType ProjectionAxisArrayType; 00080 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00081 typedef Array< double > ParametersType ; 00082 00085 typedef GaussianDensityFunction< MeasurementVectorType > 00086 ProbabilityDensityFunctionType ; 00087 00088 typedef typename ProbabilityDensityFunctionType::CovarianceType CovarianceType ; 00089 00093 typedef WeightedCovarianceCalculator< ResampledSampleType > 00094 CovarianceCalculatorType ; 00095 00097 typedef Array< double > EigenValuesArrayType; 00098 typedef SymmetricEigenAnalysis< ProjectionAxisArrayType, EigenValuesArrayType > 00099 ProjectionAxisCalculatorType; 00100 00103 unsigned int GetNumberOfParameters() const 00104 { return (unsigned int)(this->GetMeasurementVectorSize() + 1) ; } 00105 00107 void SetParameters(const ParametersType ¶meter) ; 00108 00110 CenterType* GetCenter() ; 00111 00113 RadiusType* GetRadius() ; 00114 00116 MeanType* GetMean() ; 00117 00119 StandardDeviationType* GetStandardDeviation() ; 00120 00122 double GetCumulativeProbability(double x) const ; 00123 00125 double GetProbabilityDensity(MeasurementVectorType &measurements) const ; 00126 00128 void PrintParameters(std::ostream &os) const ; 00129 00132 ParametersType GetFullParameters() const ; 00133 00135 virtual void SetInputSample( const TInputSample* sample ); 00136 00137 protected: 00138 GaussianGoodnessOfFitComponent() ; 00139 virtual ~GaussianGoodnessOfFitComponent() ; 00140 virtual void PrintSelf(std::ostream& os, Indent indent) const ; 00141 00143 virtual void CalculateProjectionAxes() ; 00144 00145 private: 00146 typename ProbabilityDensityFunctionType::Pointer 00147 m_ProbabilityDensityFunction ; 00148 typename CovarianceCalculatorType::Pointer m_CovarianceCalculator ; 00149 ProjectionAxisCalculatorType * m_ProjectionAxisCalculator ; 00150 00151 MeanType m_Mean ; 00152 CenterType m_Center ; 00153 RadiusType m_Radius ; 00154 StandardDeviationType m_StandardDeviation ; 00155 CovarianceType m_Covariance ; 00156 00157 unsigned int m_NumberOfParameters ; 00158 00159 int m_LongestAxisIndex ; 00160 double m_LargestEigenValue ; 00161 } ; // end of class 00162 00163 } // end of namespace Statistics 00164 } // end of namespace itk 00165 00166 #ifndef ITK_MANUAL_INSTANTIATION 00167 #include "itkGaussianGoodnessOfFitComponent.txx" 00168 #endif 00169 00170 #endif 00171