ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkImageClassifierFilter.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 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 {
47 template< typename TSample, typename TInputImage, typename TOutputImage >
48 class ITK_TEMPLATE_EXPORT ImageClassifierFilter:
49  public ImageToImageFilter< TInputImage, TOutputImage >
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_ASSIGN(ImageClassifierFilter);
53 
59 
61  itkTypeMacro(ImageClassifierFilter, ImageToImagefilter);
62  itkNewMacro(Self);
64 
66  using InputImageType = TInputImage;
67  using OutputImageType = TOutputImage;
68  using InputPixelType = typename TInputImage::PixelType;
69  using OutputPixelType = typename TOutputImage::PixelType;
70 
72  using InputImagePointer = typename TInputImage::Pointer;
73  using OutputImagePointer = typename TOutputImage::Pointer;
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 SetImage(const InputImageType *image);
118 
119  const InputImageType * GetImage() const;
120 
124  itkSetMacro(NumberOfClasses, unsigned int);
125  itkGetConstMacro(NumberOfClasses, unsigned int);
127 
129  itkSetConstObjectMacro(DecisionRule, DecisionRuleType);
130  itkGetConstObjectMacro(DecisionRule, DecisionRuleType);
132 
136  void SetClassLabels(const ClassLabelVectorObjectType *classLabels);
137 
141  void SetMembershipFunctions(const MembershipFunctionVectorObjectType *membershipFunctions);
142 
144  void SetMembershipFunctionsWeightsArray(const MembershipFunctionsWeightsArrayObjectType *weightsArray);
145 
146 protected:
148  ~ImageClassifierFilter() override = default;
149  void PrintSelf(std::ostream & os, Indent indent) const override;
150 
152  void GenerateData() override;
153 
154 private:
155 
156  unsigned int m_NumberOfClasses;
157 
160 }; // end of class
161 } // end of namespace Statistics
162 } // end of namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 #include "itkImageClassifierFilter.hxx"
166 #endif
167 
168 #endif
typename MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer
typename OutputImageType::Pointer OutputImagePointer
typename TInputImage::IndexType InputIndexType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
Base class for all process objects that output image data.
typename SampleType::MeasurementType MeasurementType
Base class for decision rules that return a class label based on a set of discriminant scores...
typename InputImageType::Pointer InputImagePointer
std::vector< ClassLabelType > ClassLabelVectorType
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
typename OutputImageType::RegionType OutputImageRegionType
MembershipFunctionBase defines common interfaces for membership functions.
TOutputImage OutputImageType
typename TInputImage::PixelType InputPixelType
typename InputImageType::RegionType InputImageRegionType
typename TOutputImage::IndexType OutputIndexType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TOutputImage::PixelType OutputPixelType
typename MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
typename TInputImage::SizeType InputSizeType
typename TOutputImage::SizeType OutputSizeType
typename SampleType::MeasurementVectorType MeasurementVectorType
typename MembershipFunctionType::ConstPointer MembershipFunctionPointer