00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkWeightedCovarianceCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-06-30 15:34:58 $ 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 __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); 00056 00058 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00059 00061 typedef typename TSample::MeasurementVectorType MeasurementVectorType; 00062 00064 typedef FunctionBase< MeasurementVectorType, double > WeightFunctionType; 00065 00067 typedef Array< double > MeanType; 00068 00070 typedef VariableSizeMatrix< double > OutputType; 00071 00073 typedef Array< double > WeightArrayType; 00074 00076 void SetWeights(WeightArrayType* array); 00077 00079 WeightArrayType* GetWeights( void ); 00080 00083 void SetWeightFunction(WeightFunctionType* func); 00084 00086 WeightFunctionType* GetWeightFunction( void ); 00087 00089 void SetMean(MeanType* mean); 00090 00092 MeanType* GetMean( void ); 00093 00095 OutputType* GetOutput( void ); 00096 00097 protected: 00098 WeightedCovarianceCalculator(); 00099 virtual ~WeightedCovarianceCalculator(); 00100 void PrintSelf(std::ostream& os, Indent indent) const; 00101 00103 void GenerateData( void ); 00104 00105 void ComputeCovarianceWithGivenMean( void ); 00106 00107 void ComputeCovarianceWithoutGivenMean( void ); 00108 00109 private: 00110 OutputType* m_Output; 00111 MeanType* m_Mean; 00112 MeanType* m_InternalMean; 00113 WeightArrayType* m_Weights; 00114 WeightFunctionType* m_WeightFunction; 00115 }; // end of class 00116 00117 } // end of namespace Statistics 00118 } // end of namespace itk 00119 00120 #ifndef ITK_MANUAL_INSTANTIATION 00121 #include "itkWeightedCovarianceCalculator.txx" 00122 #endif 00123 00124 #endif 00125 00126