00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkCovarianceCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 15:23:43 $ 00007 Version: $Revision: 1.16 $ 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); 00067 00069 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00070 00072 typedef typename Superclass::MeasurementVectorType MeasurementVectorType; 00073 00075 typedef Array< double > MeanType; 00076 00078 typedef VariableSizeMatrix< double > OutputType; 00079 00081 void SetMean( MeanType* mean ); 00082 00084 MeanType* GetMean( void ); 00085 00087 const OutputType * GetOutput( void ) const; 00088 00089 protected: 00090 CovarianceCalculator(); 00091 virtual ~CovarianceCalculator(); 00092 void PrintSelf(std::ostream& os, Indent indent) const; 00093 00098 void GenerateData( void ); 00099 00101 void ComputeCovarianceWithGivenMean( void ); 00102 00104 void ComputeCovarianceWithoutGivenMean( void ); 00105 00106 private: 00107 MeanType* m_Mean; 00108 MeanType* m_InternalMean; 00109 OutputType m_Output; 00110 }; // end of class 00111 00112 } // end of namespace Statistics 00113 } // end of namespace itk 00114 00115 #ifndef ITK_MANUAL_INSTANTIATION 00116 #include "itkCovarianceCalculator.txx" 00117 #endif 00118 00119 #endif 00120