ITK  6.0.0
Insight Toolkit
itkImageClassifierFilter.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 itkImageClassifierFilter_h
19#define itkImageClassifierFilter_h
20
21#include <vector>
22
24#include "itkDecisionRule.h"
27
28namespace itk
29{
30namespace Statistics
31{
48template <typename TSample, typename TInputImage, typename TOutputImage>
49class ITK_TEMPLATE_EXPORT ImageClassifierFilter : public ImageToImageFilter<TInputImage, TOutputImage>
50{
51public:
52 ITK_DISALLOW_COPY_AND_MOVE(ImageClassifierFilter);
53
59
61 itkOverrideGetNameOfClassMacro(ImageClassifierFilter);
62 itkNewMacro(Self);
66 using InputImageType = TInputImage;
67 using OutputImageType = TOutputImage;
68 using InputPixelType = typename TInputImage::PixelType;
69 using OutputPixelType = typename TOutputImage::PixelType;
70
74
81
83 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
84 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
85
87 using SampleType = TSample;
88
90 using MeasurementType = typename SampleType::MeasurementType;
91 using MeasurementVectorType = typename SampleType::MeasurementVectorType;
92
96 using MembershipFunctionVectorType = std::vector<MembershipFunctionPointer>;
99
102
105
108 using ClassLabelVectorType = std::vector<ClassLabelType>;
111
115
117 void
118 SetImage(const InputImageType * image);
119
120 const InputImageType *
121 GetImage() const;
122
126 itkSetMacro(NumberOfClasses, unsigned int);
127 itkGetConstMacro(NumberOfClasses, unsigned int);
131 itkSetConstObjectMacro(DecisionRule, DecisionRuleType);
132 itkGetConstObjectMacro(DecisionRule, DecisionRuleType);
138 void
140
144 void
146
148 void
150
151protected:
153 ~ImageClassifierFilter() override = default;
154 void
155 PrintSelf(std::ostream & os, Indent indent) const override;
156
158 void
159 GenerateData() override;
160
161private:
162 unsigned int m_NumberOfClasses{};
163
165 DecisionRulePointer m_DecisionRule{};
166}; // end of class
167} // end of namespace Statistics
168} // end of namespace itk
169
170#ifndef ITK_MANUAL_INSTANTIATION
171# include "itkImageClassifierFilter.hxx"
172#endif
173
174#endif
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
typename OutputImageType::Pointer OutputImagePointer
Base class for filters that take an image as input and produce an image as output.
typename InputImageType::Pointer InputImagePointer
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Base class for decision rules that return a class label based on a set of discriminant scores.
typename MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
typename TOutputImage::IndexType OutputIndexType
const InputImageType * GetImage() const
void SetClassLabels(const ClassLabelVectorObjectType *classLabels)
void SetMembershipFunctions(const MembershipFunctionVectorObjectType *membershipFunctions)
void SetImage(const InputImageType *image)
typename MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer
std::vector< ClassLabelType > ClassLabelVectorType
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
typename TOutputImage::PixelType OutputPixelType
typename SampleType::MeasurementType MeasurementType
typename TOutputImage::SizeType OutputSizeType
typename TInputImage::SizeType InputSizeType
typename MembershipFunctionType::ConstPointer MembershipFunctionPointer
typename SampleType::MeasurementVectorType MeasurementVectorType
typename TInputImage::PixelType InputPixelType
void PrintSelf(std::ostream &os, Indent indent) const override
void SetMembershipFunctionsWeightsArray(const MembershipFunctionsWeightsArrayObjectType *weightsArray)
typename TInputImage::IndexType InputIndexType
MembershipFunctionBase defines common interfaces for membership functions.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition: itkIntTypes.h:90