ITK  4.13.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:
66 
71  TInputImage, LevelSetType > Superclass;
72 
74  itkNewMacro( Self );
75 
78 
79  typedef TInputImage InputImageType;
80  typedef typename InputImageType::PixelType InputImagePixelType;
82  typedef typename InputImageType::Pointer InputImagePointer;
83  typedef typename InputImageType::RegionType InputImageRegionType;
86 
87  itkStaticConstMacro ( ImageDimension, unsigned int,
88  InputImageType::ImageDimension );
89 
92 
95 
98  itkSetObjectMacro( SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
99  itkGetModifiableObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
101 
105  void Initialize() ITK_OVERRIDE;
106 
107 protected:
110 
112  virtual ~BinaryImageToLevelSetImageAdaptor() ITK_OVERRIDE;
113 
114 private:
115  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
116 
117  SignedDistanceTransformFilterPointer m_SignedDistanceTransformFilter;
118 };
119 
121 
127 template< typename TInput, typename TOutput >
129  public BinaryImageToLevelSetImageAdaptorBase< TInput, TOutput >
130 {
131 public:
137 
141 
142  typedef typename Superclass::InputImageType InputImageType;
143  typedef typename Superclass::InputImagePixelType InputImagePixelType;
144  typedef typename Superclass::InputImageIndexType InputImageIndexType;
145  typedef typename Superclass::InputImagePointer InputImagePointer;
146  typedef typename Superclass::InputImageRegionType InputImageRegionType;
147  typedef typename Superclass::InputPixelRealType InputPixelRealType;
148 
149  itkStaticConstMacro ( ImageDimension, unsigned int,
150  InputImageType::ImageDimension );
151 
152  typedef typename Superclass::LevelSetType LevelSetType;
153  typedef typename Superclass::LevelSetPointer LevelSetPointer;
154 
155  typedef typename LevelSetType::InputType LevelSetInputType;
156  typedef typename LevelSetType::OutputType LevelSetOutputType;
157 
158  typedef typename LevelSetType::LabelObjectType LevelSetLabelObjectType;
159  typedef typename LevelSetLabelObjectType::LabelType LayerIdType;
160  typedef typename LevelSetType::LabelObjectPointer LevelSetLabelObjectPointer;
161  typedef typename LevelSetType::LabelObjectLengthType LevelSetLabelObjectLengthType;
162  typedef typename LevelSetType::LabelObjectLineType LevelSetLabelObjectLineType;
163 
164  typedef typename LevelSetType::LabelMapType LevelSetLabelMapType;
165  typedef typename LevelSetType::LabelMapPointer LevelSetLabelMapPointer;
166 
167  typedef typename LevelSetType::LayerType LevelSetLayerType;
168  typedef typename LevelSetType::LayerIterator LevelSetLayerIterator;
169  typedef typename LevelSetType::LayerConstIterator LevelSetLayerConstIterator;
170 
173 
174  typedef std::pair< LevelSetInputType, LevelSetOutputType > LayerPairType;
175 
178 
180 
181 protected:
184 
185  LevelSetLabelMapPointer m_LabelMap;
186 
187  InternalImagePointer m_InternalImage;
188 
189 private:
191  void operator = ( const Self& );
192 };
193 
195 
197 template< typename TInput, typename TOutput >
198 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
199  TInput,
200  WhitakerSparseLevelSetImage< TOutput, TInput::ImageDimension > > :
202  TInput,
203  WhitakerSparseLevelSetImage< TOutput, TInput::ImageDimension > >
204  {
205 public:
208 
214 
215 
217  itkNewMacro( Self );
218 
220  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
222 
224  typedef typename Superclass::InputImagePixelType InputImagePixelType;
225  typedef typename Superclass::InputImageIndexType InputImageIndexType;
226  typedef typename Superclass::InputImagePointer InputImagePointer;
227  typedef typename Superclass::InputImageRegionType InputImageRegionType;
228  typedef typename Superclass::InputPixelRealType InputPixelRealType;
229 
230  itkStaticConstMacro ( ImageDimension, unsigned int,
231  InputImageType::ImageDimension );
232 
233  typedef typename Superclass::LevelSetPointer LevelSetPointer;
234 
235  typedef typename Superclass::LevelSetInputType LevelSetInputType;
236  typedef typename Superclass::LevelSetOutputType LevelSetOutputType;
237 
238  typedef typename Superclass::LevelSetLabelObjectType LevelSetLabelObjectType;
239  typedef typename Superclass::LayerIdType LayerIdType;
240  typedef typename Superclass::LevelSetLabelObjectPointer LevelSetLabelObjectPointer;
241  typedef typename Superclass::LevelSetLabelObjectLengthType LevelSetLabelObjectLengthType;
242  typedef typename Superclass::LevelSetLabelObjectLineType LevelSetLabelObjectLineType;
243 
244  typedef typename Superclass::LevelSetLabelMapType LevelSetLabelMapType;
245  typedef typename Superclass::LevelSetLabelMapPointer LevelSetLabelMapPointer;
246 
247  typedef typename Superclass::LevelSetLayerType LevelSetLayerType;
248  typedef typename Superclass::LevelSetLayerIterator LevelSetLayerIterator;
249  typedef typename Superclass::LevelSetLayerConstIterator LevelSetLayerConstIterator;
250 
251  typedef typename Superclass::InternalImageType InternalImageType;
252  typedef typename Superclass::InternalImagePointer InternalImagePointer;
253 
254  typedef typename Superclass::LayerPairType LayerPairType;
255 
256  typedef typename Superclass::InputIteratorType InputIteratorType;
257  typedef typename Superclass::InternalIteratorType InternalIteratorType;
258 
259  typedef typename Superclass::NeighborhoodIteratorType NeighborhoodIteratorType;
260 
261  void Initialize() ITK_OVERRIDE;
262 
263 protected:
266 
268  virtual ~BinaryImageToLevelSetImageAdaptor() ITK_OVERRIDE;
269 
270 private:
271 
272  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
273 
275  void PropagateToOuterLayers( LayerIdType LayerToBeScanned, LayerIdType OutputLayer, LayerIdType TestValue );
276 
278  void FindActiveLayer();
279 
281  void FindPlusOneMinusOneLayer();
282 
283 };
284 
286 
288 template< typename TInput >
289 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
290  TInput,
291  ShiSparseLevelSetImage< TInput::ImageDimension > > :
293  TInput,
294  ShiSparseLevelSetImage< TInput::ImageDimension > >
295 {
296 public:
298 
299  typedef BinaryImageToLevelSetImageAdaptor Self;
303  TInput, LevelSetType > Superclass;
304 
306  itkNewMacro( Self );
307 
309  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
311 
313 
314  typedef typename Superclass::InputImagePixelType InputImagePixelType;
315  typedef typename Superclass::InputImageIndexType InputImageIndexType;
316  typedef typename Superclass::InputImagePointer InputImagePointer;
317  typedef typename Superclass::InputImageRegionType InputImageRegionType;
318  typedef typename Superclass::InputPixelRealType InputPixelRealType;
319 
320  itkStaticConstMacro ( ImageDimension, unsigned int,
321  InputImageType::ImageDimension );
322 
323 // typedef typename Superclass::LevelSetType LevelSetType;
324  typedef typename Superclass::LevelSetPointer LevelSetPointer;
325 
326  typedef typename Superclass::LevelSetInputType LevelSetInputType;
327  typedef typename Superclass::LevelSetOutputType LevelSetOutputType;
328 
329  typedef typename Superclass::LevelSetLabelObjectType LevelSetLabelObjectType;
330  typedef typename Superclass::LayerIdType LayerIdType;
331  typedef typename Superclass::LevelSetLabelObjectPointer LevelSetLabelObjectPointer;
332  typedef typename Superclass::LevelSetLabelObjectLengthType LevelSetLabelObjectLengthType;
333  typedef typename Superclass::LevelSetLabelObjectLineType LevelSetLabelObjectLineType;
334 
335  typedef typename Superclass::LevelSetLabelMapType LevelSetLabelMapType;
336  typedef typename Superclass::LevelSetLabelMapPointer LevelSetLabelMapPointer;
337 
338  typedef typename Superclass::LevelSetLayerType LevelSetLayerType;
339  typedef typename Superclass::LevelSetLayerIterator LevelSetLayerIterator;
340  typedef typename Superclass::LevelSetLayerConstIterator LevelSetLayerConstIterator;
341 
342  typedef typename Superclass::InternalImageType InternalImageType;
343  typedef typename Superclass::InternalImagePointer InternalImagePointer;
344 
345  typedef typename Superclass::LayerPairType LayerPairType;
346 
347  typedef typename Superclass::InputIteratorType InputIteratorType;
348  typedef typename Superclass::InternalIteratorType InternalIteratorType;
349 
350  typedef typename Superclass::NeighborhoodIteratorType NeighborhoodIteratorType;
351 
352  void Initialize() ITK_OVERRIDE;
353 
354 protected:
356  BinaryImageToLevelSetImageAdaptor();
357 
359  ~BinaryImageToLevelSetImageAdaptor() ITK_OVERRIDE;
360 
362  void FindActiveLayer();
363 
364 private:
365 
366  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
367 };
368 
369 
371 
373 template< typename TInput >
374 class ITK_TEMPLATE_EXPORT BinaryImageToLevelSetImageAdaptor<
375  TInput,
376  MalcolmSparseLevelSetImage< TInput::ImageDimension > > :
377  public BinaryImageToSparseLevelSetImageAdaptorBase< TInput, MalcolmSparseLevelSetImage< TInput::ImageDimension > >
378 {
379 public:
381 
382  typedef BinaryImageToLevelSetImageAdaptor Self;
386  TInput, LevelSetType > Superclass;
387 
388 
390  itkNewMacro( Self );
391 
393  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
395 
397 
398  typedef typename Superclass::InputImagePixelType InputImagePixelType;
399  typedef typename Superclass::InputImageIndexType InputImageIndexType;
400  typedef typename Superclass::InputImagePointer InputImagePointer;
401  typedef typename Superclass::InputImageRegionType InputImageRegionType;
402  typedef typename Superclass::InputPixelRealType InputPixelRealType;
403 
404  itkStaticConstMacro ( ImageDimension, unsigned int,
405  InputImageType::ImageDimension );
406 
407 
408  typedef typename Superclass::LevelSetPointer LevelSetPointer;
409  typedef typename Superclass::LevelSetInputType LevelSetInputType;
410  typedef typename Superclass::LevelSetOutputType LevelSetOutputType;
411 
412  typedef typename Superclass::LevelSetLabelObjectType LevelSetLabelObjectType;
413  typedef typename Superclass::LayerIdType LayerIdType;
414  typedef typename Superclass::LevelSetLabelObjectPointer LevelSetLabelObjectPointer;
415  typedef typename Superclass::LevelSetLabelObjectLengthType LevelSetLabelObjectLengthType;
416  typedef typename Superclass::LevelSetLabelObjectLineType LevelSetLabelObjectLineType;
417 
418  typedef typename Superclass::LevelSetLabelMapType LevelSetLabelMapType;
419  typedef typename Superclass::LevelSetLabelMapPointer LevelSetLabelMapPointer;
420 
421  typedef typename Superclass::LevelSetLayerType LevelSetLayerType;
422  typedef typename Superclass::LevelSetLayerIterator LevelSetLayerIterator;
423  typedef typename Superclass::LevelSetLayerConstIterator LevelSetLayerConstIterator;
424 
425  typedef typename Superclass::InternalImageType InternalImageType;
426  typedef typename Superclass::InternalImagePointer InternalImagePointer;
427 
428  typedef typename Superclass::LayerPairType LayerPairType;
429 
430  typedef typename Superclass::InputIteratorType InputIteratorType;
431  typedef typename Superclass::InternalIteratorType InternalIteratorType;
432 
433  typedef typename Superclass::NeighborhoodIteratorType NeighborhoodIteratorType;
434 
435  void Initialize() ITK_OVERRIDE;
436 
437 protected:
439  BinaryImageToLevelSetImageAdaptor();
440 
442  virtual ~BinaryImageToLevelSetImageAdaptor() ITK_OVERRIDE;
443 
445  void FindActiveLayer();
446 
448  void CreateMinimalInterface();
449 
450 private:
451 
452  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLevelSetImageAdaptor);
453 };
454 
455 }
456 
457 #ifndef ITK_MANUAL_INSTANTIATION
458 #include "itkBinaryImageToLevelSetImageAdaptor.hxx"
459 #endif
460 #endif // itkBinaryImageToLevelSetImageAdaptorBase_h
ImageRegionIteratorWithIndex< InputImageType > InputIteratorType
Light weight base class for most itk classes.
Derived class for the shi representation of level-set function.
std::pair< LevelSetInputType, LevelSetOutputType > LayerPairType
ImageRegionIteratorWithIndex< InternalImageType > InternalIteratorType
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.
ShapedNeighborhoodIterator< InternalImageType > NeighborhoodIteratorType
BinaryImageToLevelSetImageAdaptorBase< TInput, TOutput > Superclass
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.
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:59
Templated n-dimensional image class.
Definition: itkImage.h:75