00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkCovarianceCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:44 $ 00007 Version: $Revision: 1.10 $ 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 00018 #ifndef __itkCovarianceCalculator_h 00019 #define __itkCovarianceCalculator_h 00020 00021 #include "itkSampleAlgorithmBase.h" 00022 00023 #include "itkVector.h" 00024 #include "itkMatrix.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00044 template< class TSample > 00045 class CovarianceCalculator : 00046 public SampleAlgorithmBase< TSample > 00047 { 00048 public: 00050 typedef CovarianceCalculator Self; 00051 typedef Object Superclass ; 00052 typedef SmartPointer<Self> Pointer; 00053 00055 itkTypeMacro(CovarianceCalculator, Object); 00056 itkNewMacro(Self) ; 00057 00058 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00059 TSample::MeasurementVectorSize) ; 00060 00062 typedef Vector< double, itkGetStaticConstMacro(MeasurementVectorSize) > MeanType ; 00063 typedef Matrix< double, itkGetStaticConstMacro(MeasurementVectorSize), itkGetStaticConstMacro(MeasurementVectorSize) > OutputType ; 00064 00066 void SetMean(MeanType* mean) ; 00067 00069 MeanType* GetMean() ; 00070 00072 OutputType* GetOutput() ; 00073 00074 protected: 00075 CovarianceCalculator() ; 00076 virtual ~CovarianceCalculator() ; 00077 void PrintSelf(std::ostream& os, Indent indent) const; 00078 00083 void GenerateData() ; 00084 00086 void ComputeCovarianceWithGivenMean() ; 00087 00089 void ComputeCovarianceWithoutGivenMean() ; 00090 00091 private: 00092 OutputType m_Output ; 00093 MeanType* m_Mean ; 00094 MeanType* m_InternalMean ; 00095 } ; // end of class 00096 00097 } // end of namespace Statistics 00098 } // end of namespace itk 00099 00100 #ifndef ITK_MANUAL_INSTANTIATION 00101 #include "itkCovarianceCalculator.txx" 00102 #endif 00103 00104 #endif 00105