ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkBinaryImageToLevelSetImageAdaptor.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 
19 #ifndef itkBinaryImageToLevelSetImageAdaptor_h
20 #define itkBinaryImageToLevelSetImageAdaptor_h
21 
23 
24 #include "itkLevelSetDenseImage.h"
25 #include "itkImageToImageFilter.h"
26 
30 
33 
34 namespace itk
35 {
49 template< typename TInputImage, typename TLevelSet >
50 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor
51 {};
52 
53 
56 template< typename TInputImage, typename TLevelSetImage >
57 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
58  TInputImage,
59  LevelSetDenseImage< TLevelSetImage > > :
61  TInputImage,
62  LevelSetDenseImage< TLevelSetImage > >
63 {
64 public:
65  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
66 
68 
73  TInputImage, LevelSetType >;
74 
76  itkNewMacro( Self );
77 
80 
81  using InputImageType = TInputImage;
82  using InputImagePixelType = typename InputImageType::PixelType;
84  using InputImagePointer = typename InputImageType::Pointer;
87 
88  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
89 
92 
95 
98  itkSetObjectMacro( SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
99  itkGetModifiableObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
101 
105  void Initialize() override;
106 
107 protected:
110 
113 
114 private:
116 };
117 
119 
125 template< typename TInput, typename TOutput >
127  public BinaryImageToLevelSetImageAdaptorBase< TInput, TOutput >
128 {
129 public:
130  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToSparseLevelSetImageAdaptorBase);
131 
135  using Superclass =
137 
141 
142  using InputImageType = typename Superclass::InputImageType;
143  using InputImagePixelType = typename Superclass::InputImagePixelType;
144  using InputImageIndexType = typename Superclass::InputImageIndexType;
145  using InputImagePointer = typename Superclass::InputImagePointer;
146  using InputImageRegionType = typename Superclass::InputImageRegionType;
147  using InputPixelRealType = typename Superclass::InputPixelRealType;
148 
149  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
150 
151  using LevelSetType = typename Superclass::LevelSetType;
152  using LevelSetPointer = typename Superclass::LevelSetPointer;
153 
154  using LevelSetInputType = typename LevelSetType::InputType;
155  using LevelSetOutputType = typename LevelSetType::OutputType;
156 
157  using LevelSetLabelObjectType = typename LevelSetType::LabelObjectType;
158  using LayerIdType = typename LevelSetLabelObjectType::LabelType;
159  using LevelSetLabelObjectPointer = typename LevelSetType::LabelObjectPointer;
160  using LevelSetLabelObjectLengthType = typename LevelSetType::LabelObjectLengthType;
161  using LevelSetLabelObjectLineType = typename LevelSetType::LabelObjectLineType;
162 
163  using LevelSetLabelMapType = typename LevelSetType::LabelMapType;
164  using LevelSetLabelMapPointer = typename LevelSetType::LabelMapPointer;
165 
166  using LevelSetLayerType = typename LevelSetType::LayerType;
167  using LevelSetLayerIterator = typename LevelSetType::LayerIterator;
168  using LevelSetLayerConstIterator = typename LevelSetType::LayerConstIterator;
169 
172 
173  using LayerPairType = std::pair< LevelSetInputType, LevelSetOutputType >;
174 
177 
179 
180 protected:
182  ~BinaryImageToSparseLevelSetImageAdaptorBase() override = default;
183 
185 
187 };
188 
190 
192 template< typename TInput, typename TOutput >
193 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
194  TInput,
195  WhitakerSparseLevelSetImage< TOutput, TInput::ImageDimension > > :
197  TInput,
198  WhitakerSparseLevelSetImage< TOutput, TInput::ImageDimension > >
199  {
200 public:
201  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
202 
203  using LevelSetType =
205 
210  TInput, LevelSetType >;
211 
212 
214  itkNewMacro( Self );
215 
217  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
219 
220  using InputImageType = typename Superclass::InputImageType;
221  using InputImagePixelType = typename Superclass::InputImagePixelType;
222  using InputImageIndexType = typename Superclass::InputImageIndexType;
223  using InputImagePointer = typename Superclass::InputImagePointer;
224  using InputImageRegionType = typename Superclass::InputImageRegionType;
225  using InputPixelRealType = typename Superclass::InputPixelRealType;
226 
227  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
228 
229  using LevelSetPointer = typename Superclass::LevelSetPointer;
230 
231  using LevelSetInputType = typename Superclass::LevelSetInputType;
232  using LevelSetOutputType = typename Superclass::LevelSetOutputType;
233 
234  using LevelSetLabelObjectType = typename Superclass::LevelSetLabelObjectType;
235  using LayerIdType = typename Superclass::LayerIdType;
236  using LevelSetLabelObjectPointer = typename Superclass::LevelSetLabelObjectPointer;
237  using LevelSetLabelObjectLengthType = typename Superclass::LevelSetLabelObjectLengthType;
238  using LevelSetLabelObjectLineType = typename Superclass::LevelSetLabelObjectLineType;
239 
240  using LevelSetLabelMapType = typename Superclass::LevelSetLabelMapType;
241  using LevelSetLabelMapPointer = typename Superclass::LevelSetLabelMapPointer;
242 
243  using LevelSetLayerType = typename Superclass::LevelSetLayerType;
244  using LevelSetLayerIterator = typename Superclass::LevelSetLayerIterator;
245  using LevelSetLayerConstIterator = typename Superclass::LevelSetLayerConstIterator;
246 
247  using InternalImageType = typename Superclass::InternalImageType;
248  using InternalImagePointer = typename Superclass::InternalImagePointer;
249 
250  using LayerPairType = typename Superclass::LayerPairType;
251 
252  using InputIteratorType = typename Superclass::InputIteratorType;
253  using InternalIteratorType = typename Superclass::InternalIteratorType;
254 
255  using NeighborhoodIteratorType = typename Superclass::NeighborhoodIteratorType;
256 
257  void Initialize() override;
258 
259 protected:
262 
265 
266 private:
267 
269  void PropagateToOuterLayers( LayerIdType LayerToBeScanned, LayerIdType OutputLayer, LayerIdType TestValue );
270 
272  void FindActiveLayer();
273 
275  void FindPlusOneMinusOneLayer();
276 
277 };
278 
280 
282 template< typename TInput >
283 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
284  TInput,
285  ShiSparseLevelSetImage< TInput::ImageDimension > > :
287  TInput,
288  ShiSparseLevelSetImage< TInput::ImageDimension > >
289 {
290 public:
291  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
292 
294 
299  TInput, LevelSetType >;
300 
302  itkNewMacro( Self );
303 
305  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
307 
308  using InputImageType = typename Superclass::InputImageType;
309 
310  using InputImagePixelType = typename Superclass::InputImagePixelType;
311  using InputImageIndexType = typename Superclass::InputImageIndexType;
312  using InputImagePointer = typename Superclass::InputImagePointer;
313  using InputImageRegionType = typename Superclass::InputImageRegionType;
314  using InputPixelRealType = typename Superclass::InputPixelRealType;
315 
316  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
317 
318 // using LevelSetType = typename Superclass::LevelSetType;
319  using LevelSetPointer = typename Superclass::LevelSetPointer;
320 
321  using LevelSetInputType = typename Superclass::LevelSetInputType;
322  using LevelSetOutputType = typename Superclass::LevelSetOutputType;
323 
324  using LevelSetLabelObjectType = typename Superclass::LevelSetLabelObjectType;
325  using LayerIdType = typename Superclass::LayerIdType;
326  using LevelSetLabelObjectPointer = typename Superclass::LevelSetLabelObjectPointer;
327  using LevelSetLabelObjectLengthType = typename Superclass::LevelSetLabelObjectLengthType;
328  using LevelSetLabelObjectLineType = typename Superclass::LevelSetLabelObjectLineType;
329 
330  using LevelSetLabelMapType = typename Superclass::LevelSetLabelMapType;
331  using LevelSetLabelMapPointer = typename Superclass::LevelSetLabelMapPointer;
332 
333  using LevelSetLayerType = typename Superclass::LevelSetLayerType;
334  using LevelSetLayerIterator = typename Superclass::LevelSetLayerIterator;
335  using LevelSetLayerConstIterator = typename Superclass::LevelSetLayerConstIterator;
336 
337  using InternalImageType = typename Superclass::InternalImageType;
338  using InternalImagePointer = typename Superclass::InternalImagePointer;
339 
340  using LayerPairType = typename Superclass::LayerPairType;
341 
342  using InputIteratorType = typename Superclass::InputIteratorType;
343  using InternalIteratorType = typename Superclass::InternalIteratorType;
344 
345  using NeighborhoodIteratorType = typename Superclass::NeighborhoodIteratorType;
346 
347  void Initialize() override;
348 
349 protected:
352 
355 
357  void FindActiveLayer();
358 
359 private:
360 
361 };
362 
363 
365 
367 template< typename TInput >
368 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
369  TInput,
370  MalcolmSparseLevelSetImage< TInput::ImageDimension > > :
371  public BinaryImageToSparseLevelSetImageAdaptorBase< TInput, MalcolmSparseLevelSetImage< TInput::ImageDimension > >
372 {
373 public:
374  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
375 
377 
382  TInput, LevelSetType >;
383 
384 
386  itkNewMacro( Self );
387 
389  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
391 
392  using InputImageType = typename Superclass::InputImageType;
393 
394  using InputImagePixelType = typename Superclass::InputImagePixelType;
395  using InputImageIndexType = typename Superclass::InputImageIndexType;
396  using InputImagePointer = typename Superclass::InputImagePointer;
397  using InputImageRegionType = typename Superclass::InputImageRegionType;
398  using InputPixelRealType = typename Superclass::InputPixelRealType;
399 
400  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
401 
402 
403  using LevelSetPointer = typename Superclass::LevelSetPointer;
404  using LevelSetInputType = typename Superclass::LevelSetInputType;
405  using LevelSetOutputType = typename Superclass::LevelSetOutputType;
406 
407  using LevelSetLabelObjectType = typename Superclass::LevelSetLabelObjectType;
408  using LayerIdType = typename Superclass::LayerIdType;
409  using LevelSetLabelObjectPointer = typename Superclass::LevelSetLabelObjectPointer;
410  using LevelSetLabelObjectLengthType = typename Superclass::LevelSetLabelObjectLengthType;
411  using LevelSetLabelObjectLineType = typename Superclass::LevelSetLabelObjectLineType;
412 
413  using LevelSetLabelMapType = typename Superclass::LevelSetLabelMapType;
414  using LevelSetLabelMapPointer = typename Superclass::LevelSetLabelMapPointer;
415 
416  using LevelSetLayerType = typename Superclass::LevelSetLayerType;
417  using LevelSetLayerIterator = typename Superclass::LevelSetLayerIterator;
418  using LevelSetLayerConstIterator = typename Superclass::LevelSetLayerConstIterator;
419 
420  using InternalImageType = typename Superclass::InternalImageType;
421  using InternalImagePointer = typename Superclass::InternalImagePointer;
422 
423  using LayerPairType = typename Superclass::LayerPairType;
424 
425  using InputIteratorType = typename Superclass::InputIteratorType;
426  using InternalIteratorType = typename Superclass::InternalIteratorType;
427 
428  using NeighborhoodIteratorType = typename Superclass::NeighborhoodIteratorType;
429 
430  void Initialize() override;
431 
432 protected:
435 
438 
440  void FindActiveLayer();
441 
443  void CreateMinimalInterface();
444 };
445 
446 }
447 
448 #ifndef ITK_MANUAL_INSTANTIATION
449 #include "itkBinaryImageToLevelSetImageAdaptor.hxx"
450 #endif
451 #endif // itkBinaryImageToLevelSetImageAdaptorBase_h
Light weight base class for most itk classes.
Define numeric traits for std::vector.
Derived class for the shi representation of level-set function.
A neighborhood iterator which can take on an arbitrary shape.
Derived class for the Malcolm representation of level-set function.
Derived class for the sparse-field representation of level-set function.
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Base class for the &quot;dense&quot; representation of a level-set function on one image.
Base class for filters that take an image as input and produce an image as output.
Abstract class for converting binary image to sparse level-set.
Base class for most ITK classes.
Definition: itkObject.h:60
Templated n-dimensional image class.
Definition: itkImage.h:75