ITK  4.4.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< class TInputVectorImage, class TLabelsType = unsigned char,
80  class TPosteriorsPrecisionType = double, class 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 
103  typedef typename Superclass::InputImageType InputImageType;
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 
155  typedef typename Superclass::DataObjectPointer DataObjectPointer;
156 
158  typedef itk::Image< TPosteriorsPrecisionType,
159  itkGetStaticConstMacro(Dimension) > ExtractedComponentImageType;
160 
162  typedef ImageToImageFilter<
165 
167 
170  void SetSmoothingFilter(SmoothingFilterType *);
171 
172  itkGetConstMacro(SmoothingFilter, SmoothingFilterPointer);
173 
175  virtual void SetPriors(const PriorsImageType *);
176 
178  itkSetMacro(NumberOfSmoothingIterations, unsigned int);
179  itkGetConstMacro(NumberOfSmoothingIterations, unsigned int);
181 
184  using Superclass::MakeOutput;
185  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
186 
187 #ifdef ITK_USE_CONCEPT_CHECKING
188 
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 
206 #endif
207 
208 protected:
209 
212  void PrintSelf(std::ostream & os, Indent indent) const;
213 
215  virtual void GenerateData();
216 
217  virtual void GenerateOutputInformation(void);
218 
221  virtual void ComputeBayesRule();
222 
223  virtual void NormalizeAndSmoothPosteriors();
224 
225  virtual void ClassifyBasedOnPosteriors();
226 
227  PosteriorsImageType * GetPosteriorImage();
228 
229 private:
230 
231  BayesianClassifierImageFilter(const Self &); //purposely not implemented
232  void operator=(const Self &); //purposely not implemented
233 
236 
239 
242 
245 };
246 } // end namespace itk
247 
248 #ifndef ITK_MANUAL_INSTANTIATION
249 #include "itkBayesianClassifierImageFilter.hxx"
250 #endif
251 
252 #endif
253