ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkRGBGibbsPriorFilter.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 __itkRGBGibbsPriorFilter_h
19 #define __itkRGBGibbsPriorFilter_h
20 
21 #include "vnl/vnl_vector.h"
22 #include "vnl/vnl_matrix.h"
23 
24 #include "itkMRFImageFilter.h"
25 
26 namespace itk
27 {
46 template< typename TInputImage, typename TClassifiedImage >
47 class RGBGibbsPriorFilter:public MRFImageFilter< TInputImage,
48  TClassifiedImage >
49 {
50 public:
56 
58  itkNewMacro(Self);
59 
62 
70 
72  typedef TInputImage InputImageType;
73  typedef typename TInputImage::Pointer InputImagePointer;
74  typedef typename TInputImage::ConstPointer InputImageConstPointer;
75 
77  typedef typename TInputImage::PixelType InputPixelType;
78 
80  typedef TClassifiedImage ClassifiedImageType;
81  typedef typename TClassifiedImage::Pointer TrainingImageType;
82 
85  typedef typename TClassifiedImage::Pointer LabelledImageType;
86 
88  typedef typename TClassifiedImage::IndexType LabelledImageIndexType;
89 
93  typedef unsigned int LabelType;
94 
97 
99  typedef typename TInputImage::PixelType InputImageVecType;
100  typedef typename TInputImage::IndexType IndexType;
101 
104 
106  void SetLabelledImage(LabelledImageType LabelledImage);
107 
110  { return m_LabelledImage; }
111 
113  void SetClassifier(typename ClassifierType::Pointer ptrToClassifier);
114 
116  itkSetMacro(NumberOfClasses, unsigned int);
117 
119  itkGetConstMacro(NumberOfClasses, unsigned int);
120 
123  itkSetMacro(MaximumNumberOfIterations, unsigned int);
124 
127  itkGetConstMacro(MaximumNumberOfIterations, unsigned int);
128 
130  itkSetMacro(ClusterSize, unsigned int);
131 
133  itkSetMacro(ObjectLabel, LabelType);
134 
136  itkStaticConstMacro(ImageDimension, unsigned int,
137  TInputImage::ImageDimension);
138 
139  itkSetMacro(StartPoint, IndexType);
140 
141  itkSetMacro(BoundaryGradient, unsigned int);
142 
143  itkSetMacro(ObjectThreshold, double);
144 
146  itkSetMacro(CliqueWeight_1, double);
147  itkGetConstMacro(CliqueWeight_1, double);
148  itkSetMacro(CliqueWeight_2, double);
149  itkGetConstMacro(CliqueWeight_2, double);
150  itkSetMacro(CliqueWeight_3, double);
151  itkGetConstMacro(CliqueWeight_3, double);
152  itkSetMacro(CliqueWeight_4, double);
153  itkGetConstMacro(CliqueWeight_4, double);
154  itkSetMacro(CliqueWeight_5, double);
155  itkGetConstMacro(CliqueWeight_5, double);
156  itkSetMacro(CliqueWeight_6, double);
157  itkGetConstMacro(CliqueWeight_6, double);
159 
161  typedef vnl_matrix< double > MatrixType;
162 
163 protected:
166  void PrintSelf(std::ostream & os, Indent indent) const;
167 
170  virtual void MinimizeFunctional();
171 
172  virtual void GenerateData();
173 
174  virtual void ApplyGibbsLabeller();
175 
176  virtual void ApplyGPImageFilter();
177 
178 #ifdef ITK_USE_CONCEPT_CHECKING
179  // Begin concept checking
180  itkConceptMacro( SameDimension,
181  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageType::ImageDimension),
182  itkGetStaticConstMacro(ClassifiedImageType::ImageDimension) > ) );
183  itkConceptMacro( DimensionShouldBe3,
184  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageType::ImageDimension), 3 > ) );
185  // End concept checking
186 #endif
187 
188 private:
189  RGBGibbsPriorFilter(const Self &);
190  void operator=(const Self &);
191 
192  typedef typename TInputImage::SizeType InputImageSizeType;
193 
209 
231  unsigned int m_ImageHeight;
232  unsigned int m_ImageDepth;
233 
266  void GibbsTotalEnergy(int i);
267 
269  double GibbsEnergy(unsigned int i, unsigned int k, unsigned int k1);
270 
285 };
286 } // end namespace itk
287 #ifndef ITK_MANUAL_INSTANTIATION
288 #include "itkRGBGibbsPriorFilter.hxx"
289 #endif
290 #endif
void SetClassifier(typename ClassifierType::Pointer ptrToClassifier)
virtual void MinimizeFunctional()
SmartPointer< Self > Pointer
Light weight base class for most itk classes.
LabelledImageIndexType::IndexValueType IndexValueType
TClassifiedImage::PixelType LabelledImagePixelType
SmartPointer< Self > Pointer
TClassifiedImage ClassifiedImageType
Superclass::InputImageRegionConstIterator InputImageRegionConstIterator
virtual void ApplyGPImageFilter()
TInputImage::SizeType InputImageSizeType
TInputImage::PixelType InputImagePixelType
ImageRegionIterator< TInputImage > InputImageRegionIterator
SmartPointer< const Self > ConstPointer
void GibbsTotalEnergy(int i)
TClassifiedImage::Pointer LabelledImageType
ClassifierType::Pointer m_ClassifierPtr
TClassifiedImage::IndexType LabelledImageIndexType
Base class for the ImageClassifierBase object.
Implementation of a labeller object that uses Markov Random Fields to classify pixels in an image dat...
TInputImage::PixelType InputImageVecType
LabelledImageType GetLabelledImage()
ImageRegionIterator< TClassifiedImage > LabelledImageRegionIterator
ImageRegionConstIterator< TInputImage > InputImageRegionConstIterator
TClassifiedImage::Pointer TrainingImageType
TInputImage::IndexType IndexType
Superclass::IndexValueType IndexValueType
TInputImage::Pointer InputImagePointer
Superclass::LabelledImageRegionIterator LabelledImageRegionIterator
Superclass::InputImagePixelType InputImagePixelType
Superclass::LabelledImagePixelType LabelledImagePixelType
double GibbsEnergy(unsigned int i, unsigned int k, unsigned int k1)
static const unsigned int ImageDimension
virtual void ApplyGibbsLabeller()
void PrintSelf(std::ostream &os, Indent indent) const
The RGBGibbsPriorFilter applies Gibbs Prior model for the segmentation of MRF images.
vnl_matrix< double > MatrixType
void operator=(const Self &)
TInputImage::ConstPointer InputImageConstPointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImageClassifierBase< TInputImage, TClassifiedImage > ClassifierType
MRFImageFilter< TInputImage, TClassifiedImage > Superclass
void SetTrainingImage(TrainingImageType image)
Superclass::InputImageRegionIterator InputImageRegionIterator
#define itkConceptMacro(name, concept)
TInputImage::PixelType InputPixelType
virtual void GenerateData()
void SetLabelledImage(LabelledImageType LabelledImage)