ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 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 { 00027 namespace Statistics 00028 { 00041 template< class TSample > 00042 class ITK_EXPORT WeightedMeanSampleFilter : public MeanSampleFilter< TSample > 00043 { 00044 public: 00046 typedef WeightedMeanSampleFilter Self; 00047 typedef MeanSampleFilter< TSample > Superclass; 00048 typedef SmartPointer< Self > Pointer; 00049 typedef SmartPointer< const Self > ConstPointer; 00050 00052 itkTypeMacro(WeightedMeanSampleFilter, MeanSampleFilter); 00053 itkNewMacro(Self); 00055 00057 typedef typename Superclass::SampleType SampleType; 00058 typedef typename Superclass::MeasurementType MeasurementType; 00059 typedef typename Superclass::MeasurementVectorType MeasurementVectorType; 00060 typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; 00061 typedef typename Superclass::MeasurementVectorDecoratedType MeasurementVectorDecoratedType; 00062 typedef typename Superclass::OutputType OutputType; 00063 typedef typename Superclass::MeasurementRealType MeasurementRealType; 00064 typedef typename Superclass::MeasurementVectorRealType MeasurementVectorRealType; 00065 00067 typedef Array< double > WeightArrayType; 00068 00070 typedef SimpleDataObjectDecorator< WeightArrayType > InputWeightArrayObjectType; 00071 00073 itkSetGetDecoratedInputMacro(Weights, WeightArrayType); 00074 00076 typedef FunctionBase< MeasurementVectorType, double > WeightingFunctionType; 00077 00079 typedef DataObjectDecorator< WeightingFunctionType > InputWeightingFunctionObjectType; 00080 00082 itkSetGetDecoratedObjectInputMacro(WeightingFunction, WeightingFunctionType); 00083 00084 protected: 00085 WeightedMeanSampleFilter(); 00086 virtual ~WeightedMeanSampleFilter(); 00087 void PrintSelf(std::ostream & os, Indent indent) const; 00088 00089 void GenerateData(); 00090 00091 // compute mean with weight array 00092 void ComputeMeanWithWeights(); 00093 00094 // compute mean using a weighting function 00095 void ComputeMeanWithWeightingFunction(); 00096 00097 private: 00098 WeightedMeanSampleFilter(const Self &); //purposely not implemented 00099 void operator=(const Self &); //purposely not implemented 00100 }; // end of class 00101 } // end of namespace Statistics 00102 } // end of namespace itk 00103 00104 #ifndef ITK_MANUAL_INSTANTIATION 00105 #include "itkWeightedMeanSampleFilter.hxx" 00106 #endif 00107 00108 #endif 00109