ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkBayesianClassifierImageFilter.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 itkBayesianClassifierImageFilter_h
19 #define itkBayesianClassifierImageFilter_h
20 
21 #include "itkVectorImage.h"
22 #include "itkImageToImageFilter.h"
23 #include "itkMaximumDecisionRule.h"
24 #include "itkImageRegionIterator.h"
25 
26 namespace itk
27 {
79 template< typename TInputVectorImage, typename TLabelsType = unsigned char,
80  typename TPosteriorsPrecisionType = double, typename TPriorsPrecisionType = double >
82  public ImageToImageFilter<
83  TInputVectorImage, Image< TLabelsType,
84  TInputVectorImage ::ImageDimension > >
85 {
86 public:
89  typedef ImageToImageFilter<
90  TInputVectorImage,
92 
95 
97  itkNewMacro(Self);
98 
101 
104 
106  itkStaticConstMacro(Dimension, unsigned int,
107  InputImageType ::ImageDimension);
108 
109  typedef Image< TLabelsType,
110  itkGetStaticConstMacro(Dimension) > OutputImageType;
111  typedef typename InputImageType::ConstPointer InputImagePointer;
113  typedef typename InputImageType::RegionType ImageRegionType;
114 
118 
120  typedef typename InputImageType::PixelType InputPixelType;
122 
127  typedef VectorImage< TPriorsPrecisionType,
128  itkGetStaticConstMacro(Dimension) > PriorsImageType;
132 
136  typedef TInputVectorImage MembershipImageType;
137  typedef typename MembershipImageType::PixelType MembershipPixelType;
138  typedef typename MembershipImageType::Pointer MembershipImagePointer;
140 
145  typedef VectorImage< TPosteriorsPrecisionType,
146  itkGetStaticConstMacro(Dimension) > PosteriorsImageType;
150 
154 
156 
158  typedef itk::Image< TPosteriorsPrecisionType,
159  itkGetStaticConstMacro(Dimension) > ExtractedComponentImageType;
160 
162  typedef ImageToImageFilter<
165 
167 
171 
172  itkGetConstMacro(SmoothingFilter, SmoothingFilterPointer);
173 
175  virtual void SetPriors(const PriorsImageType *);
176 
178  itkSetMacro(NumberOfSmoothingIterations, unsigned int);
179  itkGetConstMacro(NumberOfSmoothingIterations, unsigned int);
181 
186 
187 #ifdef ITK_USE_CONCEPT_CHECKING
188  // Begin concept checking
189  itkConceptMacro( UnsignedIntConvertibleToLabelsCheck,
191  itkConceptMacro( PosteriorsAdditiveOperatorsCheck,
193  itkConceptMacro( IntConvertibleToPosteriorsCheck,
195  itkConceptMacro( InputHasNumericTraitsCheck,
197  itkConceptMacro( PosteriorsHasNumericTraitsCheck,
199  itkConceptMacro( PriorsHasNumericTraitsCheck,
201  itkConceptMacro( InputPriorsPosteriorsMultiplyOperatorCheck,
202  ( Concept::MultiplyOperator< typename InputPixelType::ValueType,
204  // End concept checking
205 #endif
206 
207 protected:
208 
211  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
212 
214  virtual void GenerateData() ITK_OVERRIDE;
215 
216  virtual void GenerateOutputInformation(void) ITK_OVERRIDE;
217 
220  virtual void ComputeBayesRule();
221 
222  virtual void NormalizeAndSmoothPosteriors();
223 
224  virtual void ClassifyBasedOnPosteriors();
225 
227 
228 private:
229 
230  BayesianClassifierImageFilter(const Self &); //purposely not implemented
231  void operator=(const Self &); //purposely not implemented
232 
235 
238 
241 
244 };
245 } // end namespace itk
246 
247 #ifndef ITK_MANUAL_INSTANTIATION
248 #include "itkBayesianClassifierImageFilter.hxx"
249 #endif
250 
251 #endif
ImageRegionConstIterator< PriorsImageType > PriorsImageIteratorType
virtual ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
Light weight base class for most itk classes.
ImageRegionConstIterator< InputImageType > InputImageIteratorType
ImageRegionConstIterator< MembershipImageType > MembershipImageIteratorType
Image< TLabelsType, itkGetStaticConstMacro(Dimension) > OutputImageType
ImageToImageFilter< TInputVectorImage, Image< TLabelsType, TInputVectorImage::ImageDimension > > Superclass
Templated n-dimensional vector image class.
void PrintSelf(std::ostream &os, Indent indent) const override
itk::Image< TPosteriorsPrecisionType, itkGetStaticConstMacro(Dimension) > ExtractedComponentImageType
PosteriorsImageType::PixelType PosteriorsPixelType
TPixel PixelType
Definition: itkImage.h:89
MembershipImageType::PixelType MembershipPixelType
virtual void NormalizeAndSmoothPosteriors()
VectorImage< TPosteriorsPrecisionType, itkGetStaticConstMacro(Dimension) > PosteriorsImageType
Represents an array whose length can be defined at run-time.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Performs Bayesian Classification on an image.
A multi-dimensional iterator templated over image type that walks a region of pixels.
ImageRegionIterator< PosteriorsImageType > PosteriorsImageIteratorType
PosteriorsImageType * GetPosteriorImage()
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Statistics::MaximumDecisionRule DecisionRuleType
virtual void GenerateData() override
ImageRegionIterator< OutputImageType > OutputImageIteratorType
Base class for filters that take an image as input and produce an image as output.
A decision rule that returns the class label with the largest discriminant score. ...
VectorImage< TPriorsPrecisionType, itkGetStaticConstMacro(Dimension) > PriorsImageType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImageToImageFilter< ExtractedComponentImageType, ExtractedComponentImageType > SmoothingFilterType
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
virtual void SetPriors(const PriorsImageType *)
#define itkConceptMacro(name, concept)
void SetSmoothingFilter(SmoothingFilterType *)
virtual void GenerateOutputInformation(void) override
Templated n-dimensional image class.
Definition: itkImage.h:75
A multi-dimensional iterator templated over image type that walks a region of pixels.