ITK  5.2.0
Insight Toolkit
itkWeightedMeanSampleFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
42 template <typename TSample>
43 class ITK_TEMPLATE_EXPORT WeightedMeanSampleFilter : public MeanSampleFilter<TSample>
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(WeightedMeanSampleFilter);
47 
53 
56  itkNewMacro(Self);
58 
60  using SampleType = typename Superclass::SampleType;
61  using MeasurementVectorType = typename Superclass::MeasurementVectorType;
62  using MeasurementVectorSizeType = typename Superclass::MeasurementVectorSizeType;
63  using MeasurementType = typename Superclass::MeasurementType;
64 
66  using MeasurementVectorRealType = typename Superclass::MeasurementVectorRealType;
67  using MeasurementRealType = typename Superclass::MeasurementRealType;
68 
69 
71  using WeightValueType = double;
72 
73 
76 
79 
81  itkSetGetDecoratedInputMacro(Weights, WeightArrayType);
82 
83 
86 
89 
91  itkSetGetDecoratedObjectInputMacro(WeightingFunction, WeightingFunctionType);
92 
93 
95  using MeasurementVectorDecoratedType = typename Superclass::MeasurementVectorDecoratedType;
96  using OutputType = typename Superclass::OutputType;
97 
98 protected:
100  ~WeightedMeanSampleFilter() override = default;
101  void
102  PrintSelf(std::ostream & os, Indent indent) const override;
103 
104  void
105  GenerateData() override;
106 
107  // compute mean with weight array
108  void
109  ComputeMeanWithWeights();
110 
111  // compute mean using a weighting function
112  void
113  ComputeMeanWithWeightingFunction();
114 }; // end of class
115 } // end of namespace Statistics
116 } // end of namespace itk
117 
118 #ifndef ITK_MANUAL_INSTANTIATION
119 # include "itkWeightedMeanSampleFilter.hxx"
120 #endif
121 
122 #endif
itk::SimpleDataObjectDecorator
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Definition: itkSimpleDataObjectDecorator.h:66
itk::Statistics::MeanSampleFilter::MeasurementVectorType
typename SampleType::MeasurementVectorType MeasurementVectorType
Definition: itkMeanSampleFilter.h:67
itk::Statistics::MeanSampleFilter::MeasurementType
typename SampleType::MeasurementType MeasurementType
Definition: itkMeanSampleFilter.h:73
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::MeanSampleFilter::MeasurementVectorRealType
typename NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType
Definition: itkMeanSampleFilter.h:76
itk::DataObjectDecorator
Decorates any subclass of itkObject with a DataObject API.
Definition: itkDataObjectDecorator.h:66
itkFunctionBase.h
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Statistics::MeanSampleFilter::MeasurementVectorSizeType
typename SampleType::MeasurementVectorSizeType MeasurementVectorSizeType
Definition: itkMeanSampleFilter.h:70
itk::Statistics::MeanSampleFilter
Given a sample, this filter computes the sample mean.
Definition: itkMeanSampleFilter.h:49
itkDataObjectDecorator.h
itk::Statistics::MeanSampleFilter::MeasurementRealType
typename NumericTraits< MeasurementType >::RealType MeasurementRealType
Definition: itkMeanSampleFilter.h:79
itk::FunctionBase
Base class for all ITK function objects.
Definition: itkFunctionBase.h:44
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Statistics::WeightedMeanSampleFilter
Given a sample where each measurement vector has associated weight value, this filter computes the sa...
Definition: itkWeightedMeanSampleFilter.h:43
itk::Array< WeightValueType >
itk::Statistics::MeanSampleFilter::SampleType
TSample SampleType
Definition: itkMeanSampleFilter.h:59
itk::Statistics::WeightedMeanSampleFilter::WeightValueType
double WeightValueType
Definition: itkWeightedMeanSampleFilter.h:71
itkMeanSampleFilter.h