ITK  4.8.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 {
36 template< typename TInputImage, typename TLevelSet >
38 {};
39 
40 
44 template< typename TInputImage, typename TLevelSetImage >
46  TInputImage,
47  LevelSetDenseImage< TLevelSetImage > > :
49  TInputImage,
50  LevelSetDenseImage< TLevelSetImage > >
51 {
52 public:
54 
59  TInputImage, LevelSetType > Superclass;
60 
62  itkNewMacro( Self );
63 
66 
67  typedef TInputImage InputImageType;
68  typedef typename InputImageType::PixelType InputImagePixelType;
69  typedef typename InputImageType::IndexType InputImageIndexType;
70  typedef typename InputImageType::Pointer InputImagePointer;
71  typedef typename InputImageType::RegionType InputImageRegionType;
74 
75  itkStaticConstMacro ( ImageDimension, unsigned int,
76  InputImageType::ImageDimension );
77 
80 
83 
86  itkSetObjectMacro( SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
87  itkGetModifiableObjectMacro(SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
89 
93  void Initialize() ITK_OVERRIDE;
94 
95 protected:
98 
100  virtual ~BinaryImageToLevelSetImageAdaptor();
101 
102 private:
103  BinaryImageToLevelSetImageAdaptor( const Self& ); // purposely not implemented
104  void operator = ( const Self& ); // purposely not implemented
105 
106  SignedDistanceTransformFilterPointer m_SignedDistanceTransformFilter;
107 };
108 
110 
111 template< typename TInput, typename TOutput >
113  public BinaryImageToLevelSetImageAdaptorBase< TInput, TOutput >
114 {
115 public:
121 
125 
126  typedef typename Superclass::InputImageType InputImageType;
127  typedef typename Superclass::InputImagePixelType InputImagePixelType;
128  typedef typename Superclass::InputImageIndexType InputImageIndexType;
129  typedef typename Superclass::InputImagePointer InputImagePointer;
130  typedef typename Superclass::InputImageRegionType InputImageRegionType;
131  typedef typename Superclass::InputPixelRealType InputPixelRealType;
132 
133  itkStaticConstMacro ( ImageDimension, unsigned int,
134  InputImageType::ImageDimension );
135 
136  typedef typename Superclass::LevelSetType LevelSetType;
137  typedef typename Superclass::LevelSetPointer LevelSetPointer;
138 
139  typedef typename LevelSetType::InputType LevelSetInputType;
140  typedef typename LevelSetType::OutputType LevelSetOutputType;
141 
142  typedef typename LevelSetType::LabelObjectType LevelSetLabelObjectType;
143  typedef typename LevelSetLabelObjectType::LabelType LayerIdType;
144  typedef typename LevelSetType::LabelObjectPointer LevelSetLabelObjectPointer;
145  typedef typename LevelSetType::LabelObjectLengthType LevelSetLabelObjectLengthType;
146  typedef typename LevelSetType::LabelObjectLineType LevelSetLabelObjectLineType;
147 
148  typedef typename LevelSetType::LabelMapType LevelSetLabelMapType;
149  typedef typename LevelSetType::LabelMapPointer LevelSetLabelMapPointer;
150 
151  typedef typename LevelSetType::LayerType LevelSetLayerType;
152  typedef typename LevelSetType::LayerIterator LevelSetLayerIterator;
153  typedef typename LevelSetType::LayerConstIterator LevelSetLayerConstIterator;
154 
157 
158  typedef std::pair< LevelSetInputType, LevelSetOutputType > LayerPairType;
159 
162 
164 
165 protected:
168 
169  LevelSetLabelMapPointer m_LabelMap;
170 
171  InternalImagePointer m_InternalImage;
172 
173 private:
175  void operator = ( const Self& );
176 };
177 
179 template< typename TInput, typename TOutput >
181  TInput,
182  WhitakerSparseLevelSetImage< TOutput, TInput::ImageDimension > > :
184  TInput,
185  WhitakerSparseLevelSetImage< TOutput, TInput::ImageDimension > >
186  {
187 public:
190 
196 
197 
199  itkNewMacro( Self );
200 
202  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
204 
206  typedef typename Superclass::InputImagePixelType InputImagePixelType;
207  typedef typename Superclass::InputImageIndexType InputImageIndexType;
208  typedef typename Superclass::InputImagePointer InputImagePointer;
209  typedef typename Superclass::InputImageRegionType InputImageRegionType;
210  typedef typename Superclass::InputPixelRealType InputPixelRealType;
211 
212  itkStaticConstMacro ( ImageDimension, unsigned int,
213  InputImageType::ImageDimension );
214 
215  typedef typename Superclass::LevelSetPointer LevelSetPointer;
216 
217  typedef typename Superclass::LevelSetInputType LevelSetInputType;
218  typedef typename Superclass::LevelSetOutputType LevelSetOutputType;
219 
220  typedef typename Superclass::LevelSetLabelObjectType LevelSetLabelObjectType;
221  typedef typename Superclass::LayerIdType LayerIdType;
222  typedef typename Superclass::LevelSetLabelObjectPointer LevelSetLabelObjectPointer;
223  typedef typename Superclass::LevelSetLabelObjectLengthType LevelSetLabelObjectLengthType;
224  typedef typename Superclass::LevelSetLabelObjectLineType LevelSetLabelObjectLineType;
225 
226  typedef typename Superclass::LevelSetLabelMapType LevelSetLabelMapType;
227  typedef typename Superclass::LevelSetLabelMapPointer LevelSetLabelMapPointer;
228 
229  typedef typename Superclass::LevelSetLayerType LevelSetLayerType;
230  typedef typename Superclass::LevelSetLayerIterator LevelSetLayerIterator;
231  typedef typename Superclass::LevelSetLayerConstIterator LevelSetLayerConstIterator;
232 
233  typedef typename Superclass::InternalImageType InternalImageType;
234  typedef typename Superclass::InternalImagePointer InternalImagePointer;
235 
236  typedef typename Superclass::LayerPairType LayerPairType;
237 
238  typedef typename Superclass::InputIteratorType InputIteratorType;
239  typedef typename Superclass::InternalIteratorType InternalIteratorType;
240 
241  typedef typename Superclass::NeighborhoodIteratorType NeighborhoodIteratorType;
242 
243  void Initialize() ITK_OVERRIDE;
244 
245 protected:
248 
250  virtual ~BinaryImageToLevelSetImageAdaptor();
251 
252 private:
253 
254  BinaryImageToLevelSetImageAdaptor( const Self& ); // purposely not implemented
255  void operator = ( const Self& ); // purposely not implemented
256 
258  void PropagateToOuterLayers( LayerIdType LayerToBeScanned, LayerIdType OutputLayer, LayerIdType TestValue );
259 
261  void FindActiveLayer();
262 
264  void FindPlusOneMinusOneLayer();
265 
266 };
267 
269 template< typename TInput >
270 class BinaryImageToLevelSetImageAdaptor<
271  TInput,
272  ShiSparseLevelSetImage< TInput::ImageDimension > > :
274  TInput,
275  ShiSparseLevelSetImage< TInput::ImageDimension > >
276 {
277 public:
279 
280  typedef BinaryImageToLevelSetImageAdaptor Self;
284  TInput, LevelSetType > Superclass;
285 
287  itkNewMacro( Self );
288 
290  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
292 
294 
295  typedef typename Superclass::InputImagePixelType InputImagePixelType;
296  typedef typename Superclass::InputImageIndexType InputImageIndexType;
297  typedef typename Superclass::InputImagePointer InputImagePointer;
298  typedef typename Superclass::InputImageRegionType InputImageRegionType;
299  typedef typename Superclass::InputPixelRealType InputPixelRealType;
300 
301  itkStaticConstMacro ( ImageDimension, unsigned int,
302  InputImageType::ImageDimension );
303 
304 // typedef typename Superclass::LevelSetType LevelSetType;
305  typedef typename Superclass::LevelSetPointer LevelSetPointer;
306 
307  typedef typename Superclass::LevelSetInputType LevelSetInputType;
308  typedef typename Superclass::LevelSetOutputType LevelSetOutputType;
309 
310  typedef typename Superclass::LevelSetLabelObjectType LevelSetLabelObjectType;
311  typedef typename Superclass::LayerIdType LayerIdType;
312  typedef typename Superclass::LevelSetLabelObjectPointer LevelSetLabelObjectPointer;
313  typedef typename Superclass::LevelSetLabelObjectLengthType LevelSetLabelObjectLengthType;
314  typedef typename Superclass::LevelSetLabelObjectLineType LevelSetLabelObjectLineType;
315 
316  typedef typename Superclass::LevelSetLabelMapType LevelSetLabelMapType;
317  typedef typename Superclass::LevelSetLabelMapPointer LevelSetLabelMapPointer;
318 
319  typedef typename Superclass::LevelSetLayerType LevelSetLayerType;
320  typedef typename Superclass::LevelSetLayerIterator LevelSetLayerIterator;
321  typedef typename Superclass::LevelSetLayerConstIterator LevelSetLayerConstIterator;
322 
323  typedef typename Superclass::InternalImageType InternalImageType;
324  typedef typename Superclass::InternalImagePointer InternalImagePointer;
325 
326  typedef typename Superclass::LayerPairType LayerPairType;
327 
328  typedef typename Superclass::InputIteratorType InputIteratorType;
329  typedef typename Superclass::InternalIteratorType InternalIteratorType;
330 
331  typedef typename Superclass::NeighborhoodIteratorType NeighborhoodIteratorType;
332 
333  void Initialize() ITK_OVERRIDE;
334 
335 protected:
337  BinaryImageToLevelSetImageAdaptor();
338 
340  ~BinaryImageToLevelSetImageAdaptor();
341 
343  void FindActiveLayer();
344 
345 private:
346 
347  BinaryImageToLevelSetImageAdaptor( const Self& ); // purposely not implemented
348  void operator = ( const Self& ); // purposely not implemented
349 };
350 
351 
353 template< typename TInput >
354 class BinaryImageToLevelSetImageAdaptor<
355  TInput,
356  MalcolmSparseLevelSetImage< TInput::ImageDimension > > :
357  public BinaryImageToSparseLevelSetImageAdaptorBase< TInput, MalcolmSparseLevelSetImage< TInput::ImageDimension > >
358 {
359 public:
361 
362  typedef BinaryImageToLevelSetImageAdaptor Self;
366  TInput, LevelSetType > Superclass;
367 
368 
370  itkNewMacro( Self );
371 
373  itkTypeMacro( BinaryImageToLevelSetImageAdaptor,
375 
377 
378  typedef typename Superclass::InputImagePixelType InputImagePixelType;
379  typedef typename Superclass::InputImageIndexType InputImageIndexType;
380  typedef typename Superclass::InputImagePointer InputImagePointer;
381  typedef typename Superclass::InputImageRegionType InputImageRegionType;
382  typedef typename Superclass::InputPixelRealType InputPixelRealType;
383 
384  itkStaticConstMacro ( ImageDimension, unsigned int,
385  InputImageType::ImageDimension );
386 
387 
388  typedef typename Superclass::LevelSetPointer LevelSetPointer;
389  typedef typename Superclass::LevelSetInputType LevelSetInputType;
390  typedef typename Superclass::LevelSetOutputType LevelSetOutputType;
391 
392  typedef typename Superclass::LevelSetLabelObjectType LevelSetLabelObjectType;
393  typedef typename Superclass::LayerIdType LayerIdType;
394  typedef typename Superclass::LevelSetLabelObjectPointer LevelSetLabelObjectPointer;
395  typedef typename Superclass::LevelSetLabelObjectLengthType LevelSetLabelObjectLengthType;
396  typedef typename Superclass::LevelSetLabelObjectLineType LevelSetLabelObjectLineType;
397 
398  typedef typename Superclass::LevelSetLabelMapType LevelSetLabelMapType;
399  typedef typename Superclass::LevelSetLabelMapPointer LevelSetLabelMapPointer;
400 
401  typedef typename Superclass::LevelSetLayerType LevelSetLayerType;
402  typedef typename Superclass::LevelSetLayerIterator LevelSetLayerIterator;
403  typedef typename Superclass::LevelSetLayerConstIterator LevelSetLayerConstIterator;
404 
405  typedef typename Superclass::InternalImageType InternalImageType;
406  typedef typename Superclass::InternalImagePointer InternalImagePointer;
407 
408  typedef typename Superclass::LayerPairType LayerPairType;
409 
410  typedef typename Superclass::InputIteratorType InputIteratorType;
411  typedef typename Superclass::InternalIteratorType InternalIteratorType;
412 
413  typedef typename Superclass::NeighborhoodIteratorType NeighborhoodIteratorType;
414 
415  void Initialize() ITK_OVERRIDE;
416 
417 protected:
419  BinaryImageToLevelSetImageAdaptor();
420 
422  virtual ~BinaryImageToLevelSetImageAdaptor();
423 
425  void FindActiveLayer();
426 
428  void CreateMinimalInterface();
429 
430 private:
431 
432  BinaryImageToLevelSetImageAdaptor( const Self& ); // purposely not implemented
433  void operator = ( const Self& ); // purposely not implemented
434 };
435 
436 }
437 
438 #ifndef ITK_MANUAL_INSTANTIATION
439 #include "itkBinaryImageToLevelSetImageAdaptor.hxx"
440 #endif
441 #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.
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:57
Templated n-dimensional image class.
Definition: itkImage.h:75