Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
itkBinaryThinningImageFilter3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef __itkBinaryThinningImageFilter3D_h
34 #define __itkBinaryThinningImageFilter3D_h
35 
36 #include <itkNeighborhoodIterator.h>
37 #include <itkImageToImageFilter.h>
38 #include <itkImageRegionIteratorWithIndex.h>
39 #include <itkConstantBoundaryCondition.h>
40 
41 namespace itk
42 {
77 template <class TInputImage,class TOutputImage>
79  public ImageToImageFilter<TInputImage,TOutputImage>
80 {
81 public:
84  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
85  typedef SmartPointer<Self> Pointer;
86  typedef SmartPointer<const Self> ConstPointer;
87 
90 
92  itkTypeMacro( BinaryThinningImageFilter3D, ImageToImageFilter );
93 
95  typedef TInputImage InputImageType;
96 
98  typedef TOutputImage OutputImageType;
99 
101  typedef typename InputImageType::RegionType RegionType;
102 
104  typedef typename RegionType::IndexType IndexType;
105 
108 
111 
113  typedef typename RegionType::SizeType SizeType;
114 
116  typedef typename InputImageType::ConstPointer InputImagePointer;
117 
119  typedef typename OutputImageType::Pointer OutputImagePointer;
120 
122  typedef ConstantBoundaryCondition< TInputImage > ConstBoundaryConditionType;
123 
125  typedef NeighborhoodIterator<TInputImage, ConstBoundaryConditionType> NeighborhoodIteratorType;
126 
128  typedef typename NeighborhoodIteratorType::NeighborhoodType NeighborhoodType;
129 
132 
134  itkStaticConstMacro(InputImageDimension, unsigned int,
135  TInputImage::ImageDimension );
136  itkStaticConstMacro(OutputImageDimension, unsigned int,
137  TOutputImage::ImageDimension );
138 
139 #ifdef ITK_USE_CONCEPT_CHECKING
140 
141  itkConceptMacro(SameDimensionCheck,
142  (Concept::SameDimension<InputImageDimension, 3>));
143  itkConceptMacro(SameTypeCheck,
144  (Concept::SameType<InputImagePixelType, OutputImagePixelType>));
145  itkConceptMacro(InputAdditiveOperatorsCheck,
146  (Concept::AdditiveOperators<InputImagePixelType>));
147  itkConceptMacro(InputConvertibleToIntCheck,
148  (Concept::Convertible<InputImagePixelType, int>));
149  itkConceptMacro(IntConvertibleToInputCheck,
150  (Concept::Convertible<int, InputImagePixelType>));
151  itkConceptMacro(InputIntComparableCheck,
152  (Concept::Comparable<InputImagePixelType, int>));
154 #endif
155 
156 protected:
159  void PrintSelf(std::ostream& os, Indent indent) const;
160 
162  void GenerateData();
163 
165  void PrepareData();
166 
168  void ComputeThinImage();
169 
171  bool isEulerInvariant(NeighborhoodType neighbors, int *LUT);
172  void fillEulerLUT(int *LUT);
174  bool isSimplePoint(NeighborhoodType neighbors);
176  void Octree_labeling(int octant, int label, int *cube);
177 
178 
179 private:
180  BinaryThinningImageFilter3D(const Self&); //purposely not implemented
181  void operator=(const Self&); //purposely not implemented
182 
183 }; // end of BinaryThinningImageFilter3D class
184 
185 } //end namespace itk
186 
187 #ifndef ITK_MANUAL_INSTANTIATION
188 #include "itkBinaryThinningImageFilter3D.txx"
189 #endif
190 
191 #endif
itkTypeMacro(BinaryThinningImageFilter3D, ImageToImageFilter)
ImageToImageFilter< TInputImage, TOutputImage > Superclass
ConstantBoundaryCondition< TInputImage > ConstBoundaryConditionType
NeighborhoodIteratorType::NeighborhoodType NeighborhoodType
bool isEulerInvariant(NeighborhoodType neighbors, int *LUT)
NeighborhoodIterator< TInputImage, ConstBoundaryConditionType > NeighborhoodIteratorType
void PrintSelf(std::ostream &os, Indent indent) const
void Octree_labeling(int octant, int label, int *cube)
InputImageType::ConstPointer InputImagePointer
OutputImageType * GetThinning(void)
short PixelType
bool isSimplePoint(NeighborhoodType neighbors)
This filter computes one-pixel-wide skeleton of a 3D input image.
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)