00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkCovarianceCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/07/26 15:54:54 $ 00007 Version: $Revision: 1.13 $ 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 "itkArray.h" 00024 #include "itkVariableSizeMatrix.h" 00025 00026 namespace itk{ 00027 namespace Statistics{ 00028 00052 template< class TSample > 00053 class CovarianceCalculator : 00054 public SampleAlgorithmBase< TSample > 00055 { 00056 public: 00058 typedef CovarianceCalculator Self; 00059 typedef SampleAlgorithmBase< TSample > Superclass ; 00060 typedef SmartPointer<Self> Pointer; 00061 typedef SmartPointer<const Self> ConstPointer; 00062 00064 itkTypeMacro(CovarianceCalculator, SampleAlgorithmBase); 00065 itkNewMacro(Self) ; 00066 00068 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00069 00071 typedef typename Superclass::MeasurementVectorType MeasurementVectorType; 00072 00074 typedef Array< double > MeanType; 00075 00077 typedef VariableSizeMatrix< double > OutputType; 00078 00080 void SetMean(MeanType* mean) ; 00081 00083 MeanType* GetMean() ; 00084 00086 const OutputType * GetOutput() const; 00087 00088 protected: 00089 CovarianceCalculator() ; 00090 virtual ~CovarianceCalculator() ; 00091 void PrintSelf(std::ostream& os, Indent indent) const; 00092 00097 void GenerateData() ; 00098 00100 void ComputeCovarianceWithGivenMean() ; 00101 00103 void ComputeCovarianceWithoutGivenMean() ; 00104 00105 private: 00106 MeanType* m_Mean ; 00107 MeanType* m_InternalMean ; 00108 OutputType m_Output ; 00109 } ; // end of class 00110 00111 } // end of namespace Statistics 00112 } // end of namespace itk 00113 00114 #ifndef ITK_MANUAL_INSTANTIATION 00115 #include "itkCovarianceCalculator.txx" 00116 #endif 00117 00118 #endif 00119