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"
25 #include "itkImageToImageFilter.h"
27 
28 namespace itk
29 {
30 namespace Statistics
31 {
48 template <typename TSample, typename TInputImage, typename TOutputImage>
49 class ITK_TEMPLATE_EXPORT ImageClassifierFilter : public ImageToImageFilter<TInputImage, TOutputImage>
50 {
51 public:
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
139  SetClassLabels(const ClassLabelVectorObjectType * classLabels);
140 
144  void
145  SetMembershipFunctions(const MembershipFunctionVectorObjectType * membershipFunctions);
146 
148  void
149  SetMembershipFunctionsWeightsArray(const MembershipFunctionsWeightsArrayObjectType * weightsArray);
150 
151 protected:
153  ~ImageClassifierFilter() override = default;
154  void
155  PrintSelf(std::ostream & os, Indent indent) const override;
156 
158  void
159  GenerateData() override;
160 
161 private:
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
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::ImageClassifierFilter::SampleType
TSample SampleType
Definition: itkImageClassifierFilter.h:87
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Statistics::ImageClassifierFilter::MembershipFunctionPointer
typename MembershipFunctionType::ConstPointer MembershipFunctionPointer
Definition: itkImageClassifierFilter.h:95
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
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::Statistics::ImageClassifierFilter::MembershipFunctionVectorType
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
Definition: itkImageClassifierFilter.h:96
itk::Statistics::ImageClassifierFilter::MeasurementVectorType
typename SampleType::MeasurementVectorType MeasurementVectorType
Definition: itkImageClassifierFilter.h:91
itk::Statistics::ImageClassifierFilter::MeasurementType
typename SampleType::MeasurementType MeasurementType
Definition: itkImageClassifierFilter.h:90
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::Statistics::ImageClassifierFilter::InputSizeType
typename TInputImage::SizeType InputSizeType
Definition: itkImageClassifierFilter.h:75
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::Statistics::ImageClassifierFilter::OutputIndexType
typename TOutputImage::IndexType OutputIndexType
Definition: itkImageClassifierFilter.h:79
itk::Statistics::ImageClassifierFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkImageClassifierFilter.h:69
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::Statistics::ImageClassifierFilter
Image classification class.
Definition: itkImageClassifierFilter.h:49
itk::Statistics::ImageClassifierFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkImageClassifierFilter.h:68
itkMembershipFunctionBase.h
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
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::Array< double >
itk::Statistics::ImageClassifierFilter::OutputSizeType
typename TOutputImage::SizeType OutputSizeType
Definition: itkImageClassifierFilter.h:78
itk::Statistics::ImageClassifierFilter::ClassLabelVectorType
std::vector< ClassLabelType > ClassLabelVectorType
Definition: itkImageClassifierFilter.h:108
itkSimpleDataObjectDecorator.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:90
itk::Statistics::ImageClassifierFilter::ClassLabelType
IdentifierType ClassLabelType
Definition: itkImageClassifierFilter.h:107
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::Statistics::ImageClassifierFilter::MembershipFunctionsWeightsArrayPointer
typename MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer
Definition: itkImageClassifierFilter.h:104
itk::Statistics::ImageClassifierFilter::InputIndexType
typename TInputImage::IndexType InputIndexType
Definition: itkImageClassifierFilter.h:76
itk::Statistics::ImageClassifierFilter::MembershipFunctionVectorObjectPointer
typename MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
Definition: itkImageClassifierFilter.h:98