ITK  4.2.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  ::itk::GetImageDimension< TInputVectorImage >::ImageDimension > >
85 {
86 public:
89  typedef ImageToImageFilter<
90  TInputVectorImage,
91  Image< TLabelsType,
93  TInputVectorImage >::ImageDimension > > Superclass;
94 
97 
99  itkNewMacro(Self);
100 
103 
105  typedef typename Superclass::InputImageType InputImageType;
106 
108  itkStaticConstMacro(Dimension, unsigned int,
110 
111  typedef Image< TLabelsType,
112  itkGetStaticConstMacro(Dimension) > OutputImageType;
113  typedef typename InputImageType::ConstPointer InputImagePointer;
115  typedef typename InputImageType::RegionType ImageRegionType;
116 
120 
122  typedef typename InputImageType::PixelType InputPixelType;
124 
129  typedef VectorImage< TPriorsPrecisionType,
130  itkGetStaticConstMacro(Dimension) > PriorsImageType;
134 
138  typedef TInputVectorImage MembershipImageType;
139  typedef typename MembershipImageType::PixelType MembershipPixelType;
140  typedef typename MembershipImageType::Pointer MembershipImagePointer;
142 
147  typedef VectorImage< TPosteriorsPrecisionType,
148  itkGetStaticConstMacro(Dimension) > PosteriorsImageType;
152 
156 
157  typedef typename Superclass::DataObjectPointer DataObjectPointer;
158 
160  typedef itk::Image< TPosteriorsPrecisionType,
161  itkGetStaticConstMacro(Dimension) > ExtractedComponentImageType;
162 
164  typedef ImageToImageFilter<
167 
169 
172  void SetSmoothingFilter(SmoothingFilterType *);
173 
174  itkGetConstMacro(SmoothingFilter, SmoothingFilterPointer);
175 
177  virtual void SetPriors(const PriorsImageType *);
178 
180  itkSetMacro(NumberOfSmoothingIterations, unsigned int);
181  itkGetConstMacro(NumberOfSmoothingIterations, unsigned int);
183 
186  using Superclass::MakeOutput;
187  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
188 
189 #ifdef ITK_USE_CONCEPT_CHECKING
190 
191  itkConceptMacro( UnsignedIntConvertibleToLabelsCheck,
193  itkConceptMacro( PosteriorsAdditiveOperatorsCheck,
195  itkConceptMacro( IntConvertibleToPosteriorsCheck,
197  itkConceptMacro( InputHasNumericTraitsCheck,
199  itkConceptMacro( PosteriorsHasNumericTraitsCheck,
201  itkConceptMacro( PriorsHasNumericTraitsCheck,
203  itkConceptMacro( InputPriorsPosteriorsMultiplyOperatorCheck,
204  ( Concept::MultiplyOperator< typename InputPixelType::ValueType,
206 
208 #endif
209 protected:
210 
213  void PrintSelf(std::ostream & os, Indent indent) const;
214 
216  virtual void GenerateData();
217 
218  virtual void GenerateOutputInformation(void);
219 
222  virtual void ComputeBayesRule();
223 
224  virtual void NormalizeAndSmoothPosteriors();
225 
226  virtual void ClassifyBasedOnPosteriors();
227 
228  PosteriorsImageType * GetPosteriorImage();
229 
230 private:
231 
232  BayesianClassifierImageFilter(const Self &); //purposely not implemented
233  void operator=(const Self &); //purposely not implemented
234 
237 
240 
243 
246 };
247 } // end namespace itk
248 
249 #ifndef ITK_MANUAL_INSTANTIATION
250 #include "itkBayesianClassifierImageFilter.hxx"
251 #endif
252 
253 #endif
254