ITK  4.3.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< class TInputImage, class TLevelSet >
38 {};
39 
40 
44 template< class TInputImage, class 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  itkGetObjectMacro( SignedDistanceTransformFilter, SignedDistanceTransformFilterType );
89 
93  void Initialize();
94 
95 protected:
98 
101 
102 private:
103  BinaryImageToLevelSetImageAdaptor( const Self& ); // purposely not implemented
104  void operator = ( const Self& ); // purposely not implemented
105 
107 };
108 
110 
111 template< class TInput, class TOutput >
113  public BinaryImageToLevelSetImageAdaptorBase< TInput, TOutput >
114 {
115 public:
121 
125 
132 
133  itkStaticConstMacro ( ImageDimension, unsigned int,
134  InputImageType::ImageDimension );
135 
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 
170 
172 
173 private:
175  void operator = ( const Self& );
176 };
177 
179 template< class 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();
244 
245 protected:
248 
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< class TInput >
271  TInput,
272  ShiSparseLevelSetImage< TInput::ImageDimension > > :
274  TInput,
275  ShiSparseLevelSetImage< TInput::ImageDimension > >
276 {
277 public:
279 
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();
334 
335 protected:
338 
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< class TInput >
355  TInput,
356  MalcolmSparseLevelSetImage< TInput::ImageDimension > > :
357  public BinaryImageToSparseLevelSetImageAdaptorBase< TInput, MalcolmSparseLevelSetImage< TInput::ImageDimension > >
358 {
359 public:
361 
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();
416 
417 protected:
420 
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
442