ITK  6.0.0
Insight Toolkit
itkBinaryImageToLevelSetImageAdaptor.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
19#ifndef itkBinaryImageToLevelSetImageAdaptor_h
20#define itkBinaryImageToLevelSetImageAdaptor_h
21
23
26
30
33
34namespace itk
35{
50template <typename TInputImage, typename TLevelSet>
51class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor
52{};
53
54
57template <typename TInputImage, typename TLevelSetImage>
58class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<TInputImage, LevelSetDenseImage<TLevelSetImage>>
59 : public BinaryImageToLevelSetImageAdaptorBase<TInputImage, LevelSetDenseImage<TLevelSetImage>>
60{
61public:
62 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
63
65
70
72 itkNewMacro(Self);
73
75 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
76
77 using InputImageType = TInputImage;
78 using InputImagePixelType = typename InputImageType::PixelType;
83
84 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
85
88
91
94 itkSetObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType);
95 itkGetModifiableObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType);
101 void
102 Initialize() override;
103
104protected:
107
110
111private:
112 SignedDistanceTransformFilterPointer m_SignedDistanceTransformFilter{};
113};
114
116
123template <typename TInput, typename TOutput>
125 : public BinaryImageToLevelSetImageAdaptorBase<TInput, TOutput>
126{
127public:
128 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToSparseLevelSetImageAdaptorBase);
129
134
136 itkOverrideGetNameOfClassMacro(BinaryImageToSparseLevelSetImageAdaptorBase);
137
138 using typename Superclass::InputImageType;
139 using typename Superclass::InputImagePixelType;
140 using typename Superclass::InputImageIndexType;
141 using typename Superclass::InputImagePointer;
142 using typename Superclass::InputImageRegionType;
143 using typename Superclass::InputPixelRealType;
144
145 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
146
147 using typename Superclass::LevelSetType;
148 using typename Superclass::LevelSetPointer;
149
150 using LevelSetInputType = typename LevelSetType::InputType;
151 using LevelSetOutputType = typename LevelSetType::OutputType;
152
153 using LevelSetLabelObjectType = typename LevelSetType::LabelObjectType;
154 using LayerIdType = typename LevelSetLabelObjectType::LabelType;
155 using LevelSetLabelObjectPointer = typename LevelSetType::LabelObjectPointer;
156 using LevelSetLabelObjectLengthType = typename LevelSetType::LabelObjectLengthType;
157 using LevelSetLabelObjectLineType = typename LevelSetType::LabelObjectLineType;
158
159 using LevelSetLabelMapType = typename LevelSetType::LabelMapType;
160 using LevelSetLabelMapPointer = typename LevelSetType::LabelMapPointer;
161
162 using LevelSetLayerType = typename LevelSetType::LayerType;
163 using LevelSetLayerIterator = typename LevelSetType::LayerIterator;
164 using LevelSetLayerConstIterator = typename LevelSetType::LayerConstIterator;
165
168
169 using LayerPairType = std::pair<LevelSetInputType, LevelSetOutputType>;
170
173
175
176protected:
178 : Superclass()
179 {}
181
183
184 InternalImagePointer m_InternalImage{};
185};
186
188
190template <typename TInput, typename TOutput>
191class ITK_TEMPLATE_EXPORT
192 BinaryImageToLevelSetImageAdaptor<TInput, WhitakerSparseLevelSetImage<TOutput, TInput::ImageDimension>>
194 WhitakerSparseLevelSetImage<TOutput, TInput::ImageDimension>>
195{
196public:
197 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
198
200
205
206
208 itkNewMacro(Self);
209
211 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
212
213 using typename Superclass::InputImageType;
214 using typename Superclass::InputImagePixelType;
215 using typename Superclass::InputImageIndexType;
216 using typename Superclass::InputImagePointer;
217 using typename Superclass::InputImageRegionType;
218 using typename Superclass::InputPixelRealType;
219
220 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
221
222 using typename Superclass::LevelSetPointer;
223
224 using typename Superclass::LevelSetInputType;
225 using typename Superclass::LevelSetOutputType;
226
227 using typename Superclass::LevelSetLabelObjectType;
228 using typename Superclass::LayerIdType;
229 using typename Superclass::LevelSetLabelObjectPointer;
230 using typename Superclass::LevelSetLabelObjectLengthType;
231 using typename Superclass::LevelSetLabelObjectLineType;
232
233 using typename Superclass::LevelSetLabelMapType;
234 using typename Superclass::LevelSetLabelMapPointer;
235
236 using typename Superclass::LevelSetLayerType;
237 using typename Superclass::LevelSetLayerIterator;
238 using typename Superclass::LevelSetLayerConstIterator;
239
240 using typename Superclass::InternalImageType;
241 using typename Superclass::InternalImagePointer;
242
243 using typename Superclass::LayerPairType;
244
245 using typename Superclass::InputIteratorType;
246 using typename Superclass::InternalIteratorType;
247
248 using typename Superclass::NeighborhoodIteratorType;
249
250 void
251 Initialize() override;
252
253protected:
256
259
260private:
262 void
263 PropagateToOuterLayers(LayerIdType layerToBeScanned, LayerIdType outputLayer, LayerIdType testValue);
264
266 void
268
270 void
272};
276
278template <typename TInput>
279class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<TInput, ShiSparseLevelSetImage<TInput::ImageDimension>>
280 : public BinaryImageToSparseLevelSetImageAdaptorBase<TInput, ShiSparseLevelSetImage<TInput::ImageDimension>>
281{
282public:
283 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
284
286
291
293 itkNewMacro(Self);
294
296 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
297
298 using typename Superclass::InputImageType;
299
300 using typename Superclass::InputImagePixelType;
301 using typename Superclass::InputImageIndexType;
302 using typename Superclass::InputImagePointer;
303 using typename Superclass::InputImageRegionType;
304 using typename Superclass::InputPixelRealType;
305
306 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
307
308 // using typename Superclass::LevelSetType;
309 using typename Superclass::LevelSetPointer;
310
311 using typename Superclass::LevelSetInputType;
312 using typename Superclass::LevelSetOutputType;
313
314 using typename Superclass::LevelSetLabelObjectType;
315 using typename Superclass::LayerIdType;
316 using typename Superclass::LevelSetLabelObjectPointer;
317 using typename Superclass::LevelSetLabelObjectLengthType;
318 using typename Superclass::LevelSetLabelObjectLineType;
319
320 using typename Superclass::LevelSetLabelMapType;
321 using typename Superclass::LevelSetLabelMapPointer;
322
323 using typename Superclass::LevelSetLayerType;
324 using typename Superclass::LevelSetLayerIterator;
325 using typename Superclass::LevelSetLayerConstIterator;
326
327 using typename Superclass::InternalImageType;
328 using typename Superclass::InternalImagePointer;
329
330 using typename Superclass::LayerPairType;
331
332 using typename Superclass::InputIteratorType;
333 using typename Superclass::InternalIteratorType;
334
335 using typename Superclass::NeighborhoodIteratorType;
336
337 void
338 Initialize() override;
339
340protected:
343
346
348 void
350
351private:
352};
353
354
356
358template <typename TInput>
359class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<TInput, MalcolmSparseLevelSetImage<TInput::ImageDimension>>
360 : public BinaryImageToSparseLevelSetImageAdaptorBase<TInput, MalcolmSparseLevelSetImage<TInput::ImageDimension>>
361{
362public:
363 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
364
366
371
372
374 itkNewMacro(Self);
375
377 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
378
379 using typename Superclass::InputImageType;
380
381 using typename Superclass::InputImagePixelType;
382 using typename Superclass::InputImageIndexType;
383 using typename Superclass::InputImagePointer;
384 using typename Superclass::InputImageRegionType;
385 using typename Superclass::InputPixelRealType;
386
387 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
388
389
390 using typename Superclass::LevelSetPointer;
391 using typename Superclass::LevelSetInputType;
392 using typename Superclass::LevelSetOutputType;
393
394 using typename Superclass::LevelSetLabelObjectType;
395 using typename Superclass::LayerIdType;
396 using typename Superclass::LevelSetLabelObjectPointer;
397 using typename Superclass::LevelSetLabelObjectLengthType;
398 using typename Superclass::LevelSetLabelObjectLineType;
399
400 using typename Superclass::LevelSetLabelMapType;
401 using typename Superclass::LevelSetLabelMapPointer;
402
403 using typename Superclass::LevelSetLayerType;
404 using typename Superclass::LevelSetLayerIterator;
405 using typename Superclass::LevelSetLayerConstIterator;
406
407 using typename Superclass::InternalImageType;
408 using typename Superclass::InternalImagePointer;
409
410 using typename Superclass::LayerPairType;
411
412 using typename Superclass::InputIteratorType;
413 using typename Superclass::InternalIteratorType;
414
415 using typename Superclass::NeighborhoodIteratorType;
416
417 void
418 Initialize() override;
419
420protected:
423
426
428 void
430
432 void
434};
435
436} // namespace itk
437
438#ifndef ITK_MANUAL_INSTANTIATION
439# include "itkBinaryImageToLevelSetImageAdaptor.hxx"
440#endif
441#endif // itkBinaryImageToLevelSetImageAdaptorBase_h
void PropagateToOuterLayers(LayerIdType layerToBeScanned, LayerIdType outputLayer, LayerIdType testValue)
Converts one binary image to the appropriate level-set type provided by the template argument TLevelS...
Abstract class for converting binary image to sparse level-set.
~BinaryImageToSparseLevelSetImageAdaptorBase() override=default
typename LevelSetType::LabelObjectLineType LevelSetLabelObjectLineType
typename LevelSetType::LabelObjectPointer LevelSetLabelObjectPointer
typename LevelSetType::LabelObjectLengthType LevelSetLabelObjectLengthType
typename LevelSetType::LayerConstIterator LevelSetLayerConstIterator
std::pair< LevelSetInputType, LevelSetOutputType > LayerPairType
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Base class for filters that take an image as input and produce an image as output.
Templated n-dimensional image class.
Definition: itkImage.h:89
Base class for the "dense" representation of a level-set function on one image.
Light weight base class for most itk classes.
Derived class for the Malcolm representation of level-set function.
Define additional traits for native types such as int or float.
A neighborhood iterator which can take on an arbitrary shape.
Derived class for the shi representation of level-set function.
Derived class for the sparse-field representation of level-set function.
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....