ITK  4.13.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:
57 
59  itkTypeMacro(ImageClassifierFilter, ImageToImagefilter);
60  itkNewMacro(Self);
62 
64  typedef TInputImage InputImageType;
65  typedef TOutputImage OutputImageType;
66  typedef typename TInputImage::PixelType InputPixelType;
67  typedef typename TOutputImage::PixelType OutputPixelType;
68 
70  typedef typename TInputImage::Pointer InputImagePointer;
71  typedef typename TOutputImage::Pointer OutputImagePointer;
72 
75  typedef typename TInputImage::RegionType InputImageRegionType;
78  typedef typename TOutputImage::RegionType OutputImageRegionType;
79 
81  itkStaticConstMacro(InputImageDimension, unsigned int,
82  TInputImage::ImageDimension);
83  itkStaticConstMacro(OutputImageDimension, unsigned int,
84  TOutputImage::ImageDimension);
86 
88  typedef TSample SampleType;
89 
91  typedef typename SampleType::MeasurementType MeasurementType;
92  typedef typename SampleType::MeasurementVectorType MeasurementVectorType;
93 
97  typedef std::vector< MembershipFunctionPointer > MembershipFunctionVectorType;
100  typedef typename
102 
105 
108  typedef typename
110 
113  typedef std::vector< ClassLabelType > ClassLabelVectorType;
117 
121 
123  void SetImage(const InputImageType *image);
124 
125  const InputImageType * GetImage() const;
126 
130  itkSetMacro(NumberOfClasses, unsigned int);
131  itkGetConstMacro(NumberOfClasses, unsigned int);
133 
135  itkSetConstObjectMacro(DecisionRule, DecisionRuleType);
136  itkGetConstObjectMacro(DecisionRule, DecisionRuleType);
138 
142  void SetClassLabels(const ClassLabelVectorObjectType *classLabels);
143 
147  void SetMembershipFunctions(const MembershipFunctionVectorObjectType *membershipFunctions);
148 
150  void SetMembershipFunctionsWeightsArray(const MembershipFunctionsWeightsArrayObjectType *weightsArray);
151 
152 protected:
154  virtual ~ImageClassifierFilter() ITK_OVERRIDE {}
155  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
156 
157  ITK_DISALLOW_COPY_AND_ASSIGN(ImageClassifierFilter);
158 
160  void GenerateData() ITK_OVERRIDE;
161 
162 private:
163 
164  unsigned int m_NumberOfClasses;
165 
167  DecisionRulePointer m_DecisionRule;
168 }; // end of class
169 } // end of namespace Statistics
170 } // end of namespace itk
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
173 #include "itkImageClassifierFilter.hxx"
174 #endif
175 
176 #endif
MembershipFunctionType::ConstPointer MembershipFunctionPointer
SimpleDataObjectDecorator< ClassLabelVectorType > ClassLabelVectorObjectType
DecisionRuleType::ConstPointer DecisionRulePointer
MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
Base class for all process objects that output image data.
MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
SampleType::MeasurementVectorType MeasurementVectorType
Base class for decision rules that return a class label based on a set of discriminant scores...
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
MembershipFunctionBase defines common interfaces for membership functions.
std::vector< ClassLabelType > ClassLabelVectorType
SimpleDataObjectDecorator< MembershipFunctionsWeightsArrayType > MembershipFunctionsWeightsArrayObjectType
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
ImageToImageFilter< TInputImage, TOutputImage > Superclass
SimpleDataObjectDecorator< MembershipFunctionVectorType > MembershipFunctionVectorObjectType
ClassLabelVectorObjectType::Pointer ClassLabelVectorObjectPointer