ITK  6.0.0
Insight Toolkit
itkSampleClassifierFilter.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  * https://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 itkSampleClassifierFilter_h
19 #define itkSampleClassifierFilter_h
20 
21 #include <vector>
22 
23 #include "itkMembershipSample.h"
25 #include "itkDecisionRule.h"
26 #include "itkProcessObject.h"
28 
29 namespace itk
30 {
31 namespace Statistics
32 {
44 template <typename TSample>
45 class ITK_TEMPLATE_EXPORT SampleClassifierFilter : public ProcessObject
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_MOVE(SampleClassifierFilter);
49 
55 
57  itkOverrideGetNameOfClassMacro(SampleClassifierFilter);
58  itkNewMacro(Self);
62  using SampleType = TSample;
63 
67 
69  using MeasurementType = typename SampleType::MeasurementType;
70  using MeasurementVectorType = typename SampleType::MeasurementVectorType;
71 
75  using MembershipFunctionVectorType = std::vector<MembershipFunctionPointer>;
78 
81 
84 
86  using ClassLabelVectorType = std::vector<ClassLabelType>;
89 
93 
95  using Superclass::SetInput;
96  void
97  SetInput(const SampleType * sample);
98 
99  const SampleType *
100  GetInput() const;
101 
103  const MembershipSampleType *
104  GetOutput() const;
105 
109  itkSetMacro(NumberOfClasses, unsigned int);
110  itkGetConstMacro(NumberOfClasses, unsigned int);
114  itkSetConstObjectMacro(DecisionRule, DecisionRuleType);
115  itkGetConstObjectMacro(DecisionRule, DecisionRuleType);
121  void
122  SetClassLabels(const ClassLabelVectorObjectType * classLabels);
123 
127  void
128  SetMembershipFunctions(const MembershipFunctionVectorObjectType * membershipFunctions);
129 
131  void
132  SetMembershipFunctionsWeightsArray(const MembershipFunctionsWeightsArrayObjectType * weightsArray);
133 
134 protected:
136  ~SampleClassifierFilter() override = default;
137  void
138  PrintSelf(std::ostream & os, Indent indent) const override;
139 
141  void
142  GenerateData() override;
143 
151  using Superclass::MakeOutput;
153  MakeOutput(DataObjectPointerArraySizeType idx) override;
156 private:
157  unsigned int m_NumberOfClasses{};
158 
160  DecisionRulePointer m_DecisionRule{};
161 }; // end of class
162 } // end of namespace Statistics
163 } // end of namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 # include "itkSampleClassifierFilter.hxx"
167 #endif
168 
169 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::SimpleDataObjectDecorator
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Definition: itkSimpleDataObjectDecorator.h:66
itk::Statistics::MembershipSample
Container for storing the instance-identifiers of other sample with their associated class labels.
Definition: itkMembershipSample.h:57
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Statistics::SampleClassifierFilter::MeasurementVectorType
typename SampleType::MeasurementVectorType MeasurementVectorType
Definition: itkSampleClassifierFilter.h:70
itk::Statistics::SampleClassifierFilter::MembershipFunctionsWeightsArrayPointer
typename MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer
Definition: itkSampleClassifierFilter.h:83
itkDecisionRule.h
itk::Statistics::MembershipFunctionBase
MembershipFunctionBase defines common interfaces for membership functions.
Definition: itkMembershipFunctionBase.h:58
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:194
itk::Statistics::SampleClassifierFilter::MeasurementType
typename SampleType::MeasurementType MeasurementType
Definition: itkSampleClassifierFilter.h:69
itk::Statistics::SampleClassifierFilter::MembershipSampleObjectPointer
typename MembershipSampleType::Pointer MembershipSampleObjectPointer
Definition: itkSampleClassifierFilter.h:66
itkMembershipSample.h
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::Statistics::SampleClassifierFilter::MembershipFunctionPointer
typename MembershipFunctionType::ConstPointer MembershipFunctionPointer
Definition: itkSampleClassifierFilter.h:74
itkProcessObject.h
itk::Statistics::SampleClassifierFilter::MembershipFunctionVectorObjectPointer
typename MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
Definition: itkSampleClassifierFilter.h:77
itkMembershipFunctionBase.h
itk::Statistics::SampleClassifierFilter::MembershipFunctionVectorType
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
Definition: itkSampleClassifierFilter.h:75
itk::Statistics::SampleClassifierFilter::SampleType
TSample SampleType
Definition: itkSampleClassifierFilter.h:62
itk::Statistics::DecisionRule
Base class for decision rules that return a class label based on a set of discriminant scores.
Definition: itkDecisionRule.h:48
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Array< double >
itk::Statistics::SampleClassifierFilter::ClassLabelVectorType
std::vector< ClassLabelType > ClassLabelVectorType
Definition: itkSampleClassifierFilter.h:86
itkSimpleDataObjectDecorator.h
itk::Statistics::SampleClassifierFilter
Sample classification class.
Definition: itkSampleClassifierFilter.h:45
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
itk::Statistics::SampleClassifierFilter::ClassLabelType
IdentifierType ClassLabelType
Definition: itkSampleClassifierFilter.h:85