ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkRGBGibbsPriorFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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#include <memory> // For unique_ptr.
27
28namespace itk
29{
55template <typename TInputImage, typename TClassifiedImage>
56class ITK_TEMPLATE_EXPORT RGBGibbsPriorFilter : public MRFImageFilter<TInputImage, TClassifiedImage>
57{
58public:
59 ITK_DISALLOW_COPY_AND_MOVE(RGBGibbsPriorFilter);
60
66
68 itkNewMacro(Self);
69
71 itkOverrideGetNameOfClassMacro(RGBGibbsPriorFilter);
72
79 using typename Superclass::IndexValueType;
80
82 using InputImageType = TInputImage;
83 using InputImagePointer = typename TInputImage::Pointer;
84 using InputImageConstPointer = typename TInputImage::ConstPointer;
85
87 using InputPixelType = typename TInputImage::PixelType;
88
90 using ClassifiedImageType = TClassifiedImage;
91 using TrainingImageType = typename TClassifiedImage::Pointer;
92
95 using LabelledImageType = typename TClassifiedImage::Pointer;
96
98 using LabelledImageIndexType = typename TClassifiedImage::IndexType;
99
103 using LabelType = unsigned int;
104
107
109 using InputImageVecType = typename TInputImage::PixelType;
110 using IndexType = typename TInputImage::IndexType;
111
114 itkSetMacro(TrainingImage, TrainingImageType);
115 itkGetConstMacro(TrainingImage, TrainingImageType);
117
119 void
121
125 {
126 return m_LabelledImage;
127 }
128
130 void
131 SetClassifier(typename ClassifierType::Pointer ptrToClassifier);
132
133
136 itkSetMacro(ClusterSize, unsigned int);
137 itkGetConstMacro(ClusterSize, unsigned int);
139
142 itkSetMacro(ObjectLabel, LabelType);
143 itkGetConstMacro(ObjectLabel, LabelType);
145
147 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
148
149 itkSetMacro(StartPoint, IndexType);
150 itkGetConstMacro(StartPoint, IndexType);
151
152 itkSetMacro(BoundaryGradient, unsigned int);
153 itkGetConstMacro(BoundaryGradient, unsigned int);
154
155 itkSetMacro(ObjectThreshold, double);
156 itkGetConstMacro(ObjectThreshold, double);
157
160 itkSetMacro(CliqueWeight_1, double);
161 itkGetConstMacro(CliqueWeight_1, double);
162 itkSetMacro(CliqueWeight_2, double);
163 itkGetConstMacro(CliqueWeight_2, double);
164 itkSetMacro(CliqueWeight_3, double);
165 itkGetConstMacro(CliqueWeight_3, double);
166 itkSetMacro(CliqueWeight_4, double);
167 itkGetConstMacro(CliqueWeight_4, double);
168 itkSetMacro(CliqueWeight_5, double);
169 itkGetConstMacro(CliqueWeight_5, double);
170 itkSetMacro(CliqueWeight_6, double);
171 itkGetConstMacro(CliqueWeight_6, double);
173
175 using MatrixType = vnl_matrix<double>;
176
177protected:
179 ~RGBGibbsPriorFilter() override = default;
180 void
181 PrintSelf(std::ostream & os, Indent indent) const override;
182
184 void
186
187 void
189
190 void
191 GenerateData() override;
192
193 virtual void
195
196 virtual void
198
200 SameDimension,
203
204private:
205 using InputImageSizeType = typename TInputImage::SizeType;
206
209
212
215
217
219 unsigned int m_BoundaryGradient{ 7 };
220
222 double m_BoundaryWeight{ 1 };
223
226
228 int m_StartRadius{ 10 };
229
232
234 std::unique_ptr<LabelType[]> m_LabelStatus{ nullptr };
235
238
240 unsigned int m_Temp{ 0 };
241
244
246 unsigned int m_ImageWidth{ 0 };
247
249 unsigned int m_ImageHeight{ 0 };
250
252 unsigned int m_ImageDepth{ 0 };
253
255 unsigned int m_ClusterSize{ 10 };
256
259
261 unsigned int m_VecDim{ 0 };
262
265
267 std::unique_ptr<unsigned short[]> m_Region{ nullptr };
268
270 std::unique_ptr<unsigned short[]> m_RegionCount{ nullptr };
271
272 // Weights for different clique configurations.
273
275 double m_CliqueWeight_1{ 0.0 };
276
278 double m_CliqueWeight_2{ 0.0 };
279
281 double m_CliqueWeight_3{ 0.0 };
282
284 double m_CliqueWeight_4{ 0.0 };
285
287 double m_CliqueWeight_5{ 0.0 };
288
290 double m_CliqueWeight_6{ 0.0 };
291
294 void
296
298 double
299 GibbsEnergy(unsigned int i, unsigned int k, unsigned int k1);
300
302 int
303 Sim(int a, int b);
304
306 unsigned int
307 LabelRegion(int i, int l, int change);
308
311 void
313
315 void
317
320 void
322
323 double m_ObjectThreshold{ 5.0 };
324};
325} // end namespace itk
326#ifndef ITK_MANUAL_INSTANTIATION
327# include "itkRGBGibbsPriorFilter.hxx"
328#endif
329#endif
Base class for the ImageClassifierBase object.
Control indentation during Print() invocation.
Definition itkIndent.h:51
ImageRegionIterator< TClassifiedImage > LabelledImageRegionIterator
ImageRegionConstIterator< TInputImage > InputImageRegionConstIterator
typename LabelledImageIndexType::IndexValueType IndexValueType
ImageRegionIterator< TInputImage > InputImageRegionIterator
typename TClassifiedImage::PixelType LabelledImagePixelType
typename TInputImage::PixelType InputImagePixelType
ImageClassifierBase< TInputImage, TClassifiedImage > ClassifierType
~RGBGibbsPriorFilter() override=default
MRFImageFilter< TInputImage, TClassifiedImage > Superclass
typename TInputImage::IndexType IndexType
SmartPointer< const Self > ConstPointer
typename TClassifiedImage::IndexType LabelledImageIndexType
void GibbsTotalEnergy(int i)
void GenerateData() override
void SetClassifier(typename ClassifierType::Pointer ptrToClassifier)
typename TInputImage::PixelType InputPixelType
unsigned int LabelRegion(int i, int l, int change)
double GibbsEnergy(unsigned int i, unsigned int k, unsigned int k1)
typename TClassifiedImage::Pointer LabelledImageType
void GreyScalarBoundary(LabelledImageIndexType Index3D)
ClassifierType::Pointer m_ClassifierPtr
static constexpr unsigned int ImageDimension
LabelledImageType GetLabelledImage()
typename TInputImage::Pointer InputImagePointer
typename TClassifiedImage::Pointer TrainingImageType
void MinimizeFunctional() override
InputImageConstPointer m_InputImage
typename TInputImage::SizeType InputImageSizeType
typename TInputImage::PixelType InputImageVecType
int Sim(int a, int b)
typename TInputImage::ConstPointer InputImageConstPointer
std::unique_ptr< unsigned short[]> m_RegionCount
virtual void ApplyGPImageFilter()
void SetLabelledImage(LabelledImageType image)
virtual void ApplyGibbsLabeller()
std::unique_ptr< LabelType[]> m_LabelStatus
void PrintSelf(std::ostream &os, Indent indent) const override
std::unique_ptr< unsigned short[]> m_Region
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....