Orfeo Toolbox  4.2
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);
158 
160  typedef vnl_matrix< double > MatrixType;
161 
162 protected:
165  void PrintSelf(std::ostream & os, Indent indent) const;
166 
167  void Allocate();
169  virtual void MinimizeFunctional();
170 
171  virtual void GenerateData();
172 
173  virtual void ApplyGibbsLabeller();
174 
175  virtual void ApplyGPImageFilter();
176 
177 #ifdef ITK_USE_CONCEPT_CHECKING
178  // Begin concept checking
179  itkConceptMacro( SameDimension,
180  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageType::ImageDimension),
181  itkGetStaticConstMacro(ClassifiedImageType::ImageDimension) > ) );
182  itkConceptMacro( DimensionShouldBe3,
183  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageType::ImageDimension), 3 > ) );
184  // End concept checking
185 #endif
186 
187 private:
188  RGBGibbsPriorFilter(const Self &);
189  void operator=(const Self &);
190 
191  typedef typename TInputImage::SizeType InputImageSizeType;
192 
197  unsigned int m_NumberOfClasses;
204 
205  unsigned int m_BoundaryGradient;
216  unsigned int m_Temp;
219  unsigned int m_ImageWidth;
220  unsigned int m_ImageHeight;
221  unsigned int m_ImageDepth;
222  unsigned int m_ClusterSize;
225  unsigned int m_VecDim;
229  unsigned short *m_Region;
230  unsigned short *m_RegionCount;
244  void GibbsTotalEnergy(int i);
245 
247  double GibbsEnergy(unsigned int i, unsigned int k, unsigned int k1);
248 
249  int Sim(int a, int b);
251  unsigned int LabelRegion(int i, int l, int change);
254  void RegionEraser();
256  void GenerateMediumImage();
263 };
264 } // end namespace itk
265 #ifndef ITK_MANUAL_INSTANTIATION
267 #endif
268 #endif

Generated at Sat Aug 30 2014 15:31:34 for Orfeo Toolbox with doxygen 1.8.3.1