ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkWeightedMeanSampleFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkWeightedMeanSampleFilter_h
19 #define itkWeightedMeanSampleFilter_h
20 
21 #include "itkMeanSampleFilter.h"
22 #include "itkFunctionBase.h"
23 #include "itkDataObjectDecorator.h"
24 
25 namespace itk
26 {
27 namespace Statistics
28 {
41 template< typename TSample >
42 class ITK_TEMPLATE_EXPORT WeightedMeanSampleFilter : public MeanSampleFilter< TSample >
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_ASSIGN(WeightedMeanSampleFilter);
46 
52 
55  itkNewMacro(Self);
57 
59  using SampleType = typename Superclass::SampleType;
60  using MeasurementVectorType = typename Superclass::MeasurementVectorType;
61  using MeasurementVectorSizeType = typename Superclass::MeasurementVectorSizeType;
62  using MeasurementType = typename Superclass::MeasurementType;
63 
65  using MeasurementVectorRealType = typename Superclass::MeasurementVectorRealType;
66  using MeasurementRealType = typename Superclass::MeasurementRealType;
67 
68 
70  using WeightValueType = double;
71 
72 
75 
78 
80  itkSetGetDecoratedInputMacro(Weights, WeightArrayType);
81 
82 
85 
88 
90  itkSetGetDecoratedObjectInputMacro(WeightingFunction, WeightingFunctionType);
91 
92 
94  using MeasurementVectorDecoratedType = typename Superclass::MeasurementVectorDecoratedType;
95  using OutputType = typename Superclass::OutputType;
96 
97 protected:
99  ~WeightedMeanSampleFilter() override = default;
100  void PrintSelf(std::ostream & os, Indent indent) const override;
101 
102  void GenerateData() override;
103 
104  // compute mean with weight array
105  void ComputeMeanWithWeights();
106 
107  // compute mean using a weighting function
108  void ComputeMeanWithWeightingFunction();
109 }; // end of class
110 } // end of namespace Statistics
111 } // end of namespace itk
112 
113 #ifndef ITK_MANUAL_INSTANTIATION
114 #include "itkWeightedMeanSampleFilter.hxx"
115 #endif
116 
117 #endif
Given a sample where each measurement vector has associated weight value, this filter computes the sa...
Light weight base class for most itk classes.
typename SampleType::MeasurementVectorSizeType MeasurementVectorSizeType
typename NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
Base class for all ITK function objects.
Decorates any subclass of itkObject with a DataObject API.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Given a sample, this filter computes the sample mean.
typename SampleType::MeasurementVectorType MeasurementVectorType
typename SampleType::MeasurementType MeasurementType
typename NumericTraits< MeasurementType >::RealType MeasurementRealType