00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkWeightedCovarianceCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/07/26 15:55:07 $ 00007 Version: $Revision: 1.8 $ 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 __itkWeightedCovarianceCalculator_h 00018 #define __itkWeightedCovarianceCalculator_h 00019 00020 #include "itkArray.h" 00021 #include "itkVariableSizeMatrix.h" 00022 #include "itkSampleAlgorithmBase.h" 00023 00024 namespace itk{ 00025 namespace Statistics{ 00026 00041 template< class TSample > 00042 class WeightedCovarianceCalculator : 00043 public SampleAlgorithmBase< TSample > 00044 { 00045 public: 00047 typedef WeightedCovarianceCalculator Self; 00048 typedef SampleAlgorithmBase< TSample > Superclass ; 00049 typedef SmartPointer<Self> Pointer; 00050 typedef SmartPointer<const Self> ConstPointer; 00051 00053 itkTypeMacro(WeightedCovarianceCalculator, SampleAlgorithmBase); 00054 itkNewMacro(Self) ; 00055 00057 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00058 00060 typedef typename TSample::MeasurementVectorType MeasurementVectorType ; 00061 00063 typedef FunctionBase< MeasurementVectorType, double > WeightFunctionType ; 00064 00066 typedef Array< double > MeanType; 00067 00069 typedef VariableSizeMatrix< double > OutputType; 00070 00072 typedef Array< double > WeightArrayType ; 00073 00075 void SetWeights(WeightArrayType* array) ; 00076 00078 WeightArrayType* GetWeights() ; 00079 00082 void SetWeightFunction(WeightFunctionType* func) ; 00083 00085 WeightFunctionType* GetWeightFunction() ; 00086 00088 void SetMean(MeanType* mean) ; 00089 00091 MeanType* GetMean() ; 00092 00094 OutputType* GetOutput() ; 00095 00096 protected: 00097 WeightedCovarianceCalculator() ; 00098 virtual ~WeightedCovarianceCalculator() ; 00099 void PrintSelf(std::ostream& os, Indent indent) const; 00100 00102 void GenerateData() ; 00103 00104 void ComputeCovarianceWithGivenMean() ; 00105 00106 void ComputeCovarianceWithoutGivenMean() ; 00107 00108 private: 00109 OutputType* m_Output ; 00110 MeanType* m_Mean ; 00111 MeanType* m_InternalMean ; 00112 WeightArrayType* m_Weights ; 00113 WeightFunctionType* m_WeightFunction ; 00114 } ; // end of class 00115 00116 } // end of namespace Statistics 00117 } // end of namespace itk 00118 00119 #ifndef ITK_MANUAL_INSTANTIATION 00120 #include "itkWeightedCovarianceCalculator.txx" 00121 #endif 00122 00123 #endif 00124