ITK  4.2.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< class TSample, class TInputImage, class TOutputImage >
48 class ITK_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 
73  typedef typename TInputImage::SizeType InputSizeType;
74  typedef typename TInputImage::IndexType InputIndexType;
75  typedef typename TInputImage::RegionType InputImageRegionType;
76  typedef typename TOutputImage::SizeType OutputSizeType;
77  typedef typename TOutputImage::IndexType OutputIndexType;
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:
155  void PrintSelf(std::ostream & os, Indent indent) const;
156 
157  ImageClassifierFilter(const Self &); //purposely not implemented
158  void operator=(const Self &); //purposely not implemented
159 
161  void GenerateData();
162 
163 private:
164 
165  unsigned int m_NumberOfClasses;
166 
169 }; // end of class
170 } // end of namespace Statistics
171 } // end of namespace itk
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "itkImageClassifierFilter.hxx"
175 #endif
176 
177 #endif
178