00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkWeightedMeanSampleFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-02 05:44:00 $ 00007 Version: $Revision: 1.1 $ 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 __itkWeightedMeanSampleFilter_h 00019 #define __itkWeightedMeanSampleFilter_h 00020 00021 #include "itkMeanSampleFilter.h" 00022 #include "itkFunctionBase.h" 00023 #include "itkDataObjectDecorator.h" 00024 00025 namespace itk { 00026 namespace Statistics { 00027 00039 template< class TSample > 00040 class ITK_EXPORT WeightedMeanSampleFilter : public MeanSampleFilter< TSample > 00041 { 00042 public: 00044 typedef WeightedMeanSampleFilter Self; 00045 typedef MeanSampleFilter< TSample > Superclass; 00046 typedef SmartPointer<Self> Pointer; 00047 typedef SmartPointer<const Self> ConstPointer; 00048 00050 itkTypeMacro(WeightedMeanSampleFilter, MeanSampleFilter); 00051 itkNewMacro(Self); 00053 00055 itkSuperclassTraitMacro( SampleType ) 00056 itkSuperclassTraitMacro( MeasurementType ) 00057 itkSuperclassTraitMacro( MeasurementVectorType ) 00058 itkSuperclassTraitMacro( MeasurementVectorSizeType ) 00059 itkSuperclassTraitMacro( MeasurementVectorDecoratedType ) 00060 itkSuperclassTraitMacro( OutputType ) 00061 00063 typedef Array< double > WeightArrayType; 00064 00066 typedef SimpleDataObjectDecorator< WeightArrayType > InputWeightArrayObjectType; 00067 00069 itkSetDecoratedInputMacro( Weights, WeightArrayType, 1 ); 00070 00072 typedef FunctionBase< MeasurementVectorType, double > WeightingFunctionType; 00073 00075 typedef DataObjectDecorator< WeightingFunctionType > InputWeightingFunctionObjectType; 00076 00078 itkSetDecoratedObjectInputMacro( WeightingFunction, WeightingFunctionType, 2 ); 00079 00080 protected: 00081 WeightedMeanSampleFilter(); 00082 virtual ~WeightedMeanSampleFilter(); 00083 void PrintSelf(std::ostream& os, Indent indent) const; 00084 00085 void GenerateData(); 00086 00087 // compute mean with weight array 00088 void ComputeMeanWithWeights(); 00089 00090 // compute mean using a weighting function 00091 void ComputeMeanWithWeightingFunction(); 00092 00093 private: 00094 WeightedMeanSampleFilter(const Self&); //purposely not implemented 00095 void operator=(const Self&); //purposely not implemented 00096 00097 }; // end of class 00098 00099 } // end of namespace Statistics 00100 } // end of namespace itk 00101 00102 #ifndef ITK_MANUAL_INSTANTIATION 00103 #include "itkWeightedMeanSampleFilter.txx" 00104 #endif 00105 00106 #endif 00107