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
56template <typename TInputImage, typename TLevelSetImage>
57class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<TInputImage, LevelSetDenseImage<TLevelSetImage>>
58 : public BinaryImageToLevelSetImageAdaptorBase<TInputImage, LevelSetDenseImage<TLevelSetImage>>
59{
60public:
61 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
62
64
69
71 itkNewMacro(Self);
72
74 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
75
76 using InputImageType = TInputImage;
77 using InputImagePixelType = typename InputImageType::PixelType;
82
83 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
84
87
90
93 itkSetObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType);
94 itkGetModifiableObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType);
100 void
101 Initialize() override;
102
103protected:
106
109
110private:
111 SignedDistanceTransformFilterPointer m_SignedDistanceTransformFilter{};
112};
113
115
122template <typename TInput, typename TOutput>
124 : public BinaryImageToLevelSetImageAdaptorBase<TInput, TOutput>
125{
126public:
127 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToSparseLevelSetImageAdaptorBase);
128
133
135 itkOverrideGetNameOfClassMacro(BinaryImageToSparseLevelSetImageAdaptorBase);
136
137 using typename Superclass::InputImageType;
138 using typename Superclass::InputImagePixelType;
139 using typename Superclass::InputImageIndexType;
140 using typename Superclass::InputImagePointer;
141 using typename Superclass::InputImageRegionType;
142 using typename Superclass::InputPixelRealType;
143
144 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
145
146 using typename Superclass::LevelSetType;
147 using typename Superclass::LevelSetPointer;
148
149 using LevelSetInputType = typename LevelSetType::InputType;
150 using LevelSetOutputType = typename LevelSetType::OutputType;
151
152 using LevelSetLabelObjectType = typename LevelSetType::LabelObjectType;
153 using LayerIdType = typename LevelSetLabelObjectType::LabelType;
154 using LevelSetLabelObjectPointer = typename LevelSetType::LabelObjectPointer;
155 using LevelSetLabelObjectLengthType = typename LevelSetType::LabelObjectLengthType;
156 using LevelSetLabelObjectLineType = typename LevelSetType::LabelObjectLineType;
157
158 using LevelSetLabelMapType = typename LevelSetType::LabelMapType;
159 using LevelSetLabelMapPointer = typename LevelSetType::LabelMapPointer;
160
161 using LevelSetLayerType = typename LevelSetType::LayerType;
162 using LevelSetLayerIterator = typename LevelSetType::LayerIterator;
163 using LevelSetLayerConstIterator = typename LevelSetType::LayerConstIterator;
164
167
168 using LayerPairType = std::pair<LevelSetInputType, LevelSetOutputType>;
169
172
174
175protected:
177 : Superclass()
178 {}
180
182
183 InternalImagePointer m_InternalImage{};
184};
185
187
189template <typename TInput, typename TOutput>
190class ITK_TEMPLATE_EXPORT
191 BinaryImageToLevelSetImageAdaptor<TInput, WhitakerSparseLevelSetImage<TOutput, TInput::ImageDimension>>
193 WhitakerSparseLevelSetImage<TOutput, TInput::ImageDimension>>
194{
195public:
196 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
197
199
204
205
207 itkNewMacro(Self);
208
210 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
211
212 using typename Superclass::InputImageType;
213 using typename Superclass::InputImagePixelType;
214 using typename Superclass::InputImageIndexType;
215 using typename Superclass::InputImagePointer;
216 using typename Superclass::InputImageRegionType;
217 using typename Superclass::InputPixelRealType;
218
219 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
220
221 using typename Superclass::LevelSetPointer;
222
223 using typename Superclass::LevelSetInputType;
224 using typename Superclass::LevelSetOutputType;
225
226 using typename Superclass::LevelSetLabelObjectType;
227 using typename Superclass::LayerIdType;
228 using typename Superclass::LevelSetLabelObjectPointer;
229 using typename Superclass::LevelSetLabelObjectLengthType;
230 using typename Superclass::LevelSetLabelObjectLineType;
231
232 using typename Superclass::LevelSetLabelMapType;
233 using typename Superclass::LevelSetLabelMapPointer;
234
235 using typename Superclass::LevelSetLayerType;
236 using typename Superclass::LevelSetLayerIterator;
237 using typename Superclass::LevelSetLayerConstIterator;
238
239 using typename Superclass::InternalImageType;
240 using typename Superclass::InternalImagePointer;
241
242 using typename Superclass::LayerPairType;
243
244 using typename Superclass::InputIteratorType;
245 using typename Superclass::InternalIteratorType;
246
247 using typename Superclass::NeighborhoodIteratorType;
248
249 void
250 Initialize() override;
251
252protected:
255
258
259private:
261 void
262 PropagateToOuterLayers(LayerIdType layerToBeScanned, LayerIdType outputLayer, LayerIdType testValue);
263
265 void
267
269 void
271};
275
277template <typename TInput>
278class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<TInput, ShiSparseLevelSetImage<TInput::ImageDimension>>
279 : public BinaryImageToSparseLevelSetImageAdaptorBase<TInput, ShiSparseLevelSetImage<TInput::ImageDimension>>
280{
281public:
282 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
283
285
290
292 itkNewMacro(Self);
293
295 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
296
297 using typename Superclass::InputImageType;
298
299 using typename Superclass::InputImagePixelType;
300 using typename Superclass::InputImageIndexType;
301 using typename Superclass::InputImagePointer;
302 using typename Superclass::InputImageRegionType;
303 using typename Superclass::InputPixelRealType;
304
305 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
306
307 // using typename Superclass::LevelSetType;
308 using typename Superclass::LevelSetPointer;
309
310 using typename Superclass::LevelSetInputType;
311 using typename Superclass::LevelSetOutputType;
312
313 using typename Superclass::LevelSetLabelObjectType;
314 using typename Superclass::LayerIdType;
315 using typename Superclass::LevelSetLabelObjectPointer;
316 using typename Superclass::LevelSetLabelObjectLengthType;
317 using typename Superclass::LevelSetLabelObjectLineType;
318
319 using typename Superclass::LevelSetLabelMapType;
320 using typename Superclass::LevelSetLabelMapPointer;
321
322 using typename Superclass::LevelSetLayerType;
323 using typename Superclass::LevelSetLayerIterator;
324 using typename Superclass::LevelSetLayerConstIterator;
325
326 using typename Superclass::InternalImageType;
327 using typename Superclass::InternalImagePointer;
328
329 using typename Superclass::LayerPairType;
330
331 using typename Superclass::InputIteratorType;
332 using typename Superclass::InternalIteratorType;
333
334 using typename Superclass::NeighborhoodIteratorType;
335
336 void
337 Initialize() override;
338
339protected:
342
345
347 void
349
350private:
351};
352
353
355
357template <typename TInput>
358class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<TInput, MalcolmSparseLevelSetImage<TInput::ImageDimension>>
359 : public BinaryImageToSparseLevelSetImageAdaptorBase<TInput, MalcolmSparseLevelSetImage<TInput::ImageDimension>>
360{
361public:
362 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLevelSetImageAdaptor);
363
365
370
371
373 itkNewMacro(Self);
374
376 itkOverrideGetNameOfClassMacro(BinaryImageToLevelSetImageAdaptor);
377
378 using typename Superclass::InputImageType;
379
380 using typename Superclass::InputImagePixelType;
381 using typename Superclass::InputImageIndexType;
382 using typename Superclass::InputImagePointer;
383 using typename Superclass::InputImageRegionType;
384 using typename Superclass::InputPixelRealType;
385
386 static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
387
388
389 using typename Superclass::LevelSetPointer;
390 using typename Superclass::LevelSetInputType;
391 using typename Superclass::LevelSetOutputType;
392
393 using typename Superclass::LevelSetLabelObjectType;
394 using typename Superclass::LayerIdType;
395 using typename Superclass::LevelSetLabelObjectPointer;
396 using typename Superclass::LevelSetLabelObjectLengthType;
397 using typename Superclass::LevelSetLabelObjectLineType;
398
399 using typename Superclass::LevelSetLabelMapType;
400 using typename Superclass::LevelSetLabelMapPointer;
401
402 using typename Superclass::LevelSetLayerType;
403 using typename Superclass::LevelSetLayerIterator;
404 using typename Superclass::LevelSetLayerConstIterator;
405
406 using typename Superclass::InternalImageType;
407 using typename Superclass::InternalImagePointer;
408
409 using typename Superclass::LayerPairType;
410
411 using typename Superclass::InputIteratorType;
412 using typename Superclass::InternalIteratorType;
413
414 using typename Superclass::NeighborhoodIteratorType;
415
416 void
417 Initialize() override;
418
419protected:
422
425
427 void
429
431 void
433};
434
435} // namespace itk
436
437#ifndef ITK_MANUAL_INSTANTIATION
438# include "itkBinaryImageToLevelSetImageAdaptor.hxx"
439#endif
440#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....