00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkWeightedMeanCalculator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/21 05:44:26 $ 00007 Version: $Revision: 1.4 $ 00008 00009 Copyright (c) 2002 Insight 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 __itkWeightedMeanCalculator_h 00019 #define __itkWeightedMeanCalculator_h 00020 00021 #include <vnl/vnl_vector.h> 00022 #include <vnl/vnl_matrix.h> 00023 00024 #include "itkArray.h" 00025 #include "itkVector.h" 00026 #include "itkFunctionBase.h" 00027 #include "itkSampleAlgorithmBase.h" 00028 00029 namespace itk{ 00030 namespace Statistics{ 00031 00043 template< class TSample > 00044 class WeightedMeanCalculator : 00045 public SampleAlgorithmBase< TSample > 00046 { 00047 public: 00049 typedef WeightedMeanCalculator Self; 00050 typedef SampleAlgorithmBase< TSample > Superclass ; 00051 typedef SmartPointer<Self> Pointer; 00052 00054 itkTypeMacro(WeightedMeanCalculator, SampleAlgorithmBase); 00055 itkNewMacro(Self) ; 00056 00057 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00058 TSample::MeasurementVectorSize); 00059 00060 typedef typename TSample::MeasurementVectorType MeasurementVectorType ; 00061 00063 typedef Vector< double, itkGetStaticConstMacro(MeasurementVectorSize) > OutputType ; 00064 00066 typedef Array< double > WeightArrayType ; 00067 00069 void SetWeights(WeightArrayType* array) ; 00070 00072 WeightArrayType* GetWeights() ; 00073 00075 typedef FunctionBase< MeasurementVectorType, double > WeightFunctionType ; 00076 00080 void SetWeightFunction(WeightFunctionType* func) ; 00081 00083 WeightFunctionType* GetWeightFunction() ; 00084 00086 OutputType* GetOutput() ; 00087 00088 protected: 00089 WeightedMeanCalculator() ; 00090 virtual ~WeightedMeanCalculator() {} 00091 void PrintSelf(std::ostream& os, Indent indent) const; 00092 00094 void GenerateData() ; 00095 00096 private: 00097 WeightArrayType* m_Weights ; 00098 WeightFunctionType* m_WeightFunction ; 00099 OutputType m_Output ; 00100 } ; // end of class 00101 00102 } // end of namespace Statistics 00103 } // end of namespace itk 00104 00105 #ifndef ITK_MANUAL_INSTANTIATION 00106 #include "itkWeightedMeanCalculator.txx" 00107 #endif 00108 00109 #endif 00110