]> Creatis software - clitk.git/blobdiff - itk/itkBinaryThinningImageFilter3D.h
cosmetic
[clitk.git] / itk / itkBinaryThinningImageFilter3D.h
index 12926e9bbee3f6dca4860191afa2991553c1b6be..f75d8834683d7dad62019931534913408ec5f96a 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================*/
-#ifndef __itkBinaryThinningImageFilter3D_h\r
-#define __itkBinaryThinningImageFilter3D_h\r
-\r
-#include <itkNeighborhoodIterator.h>\r
-#include <itkImageToImageFilter.h>\r
-#include <itkImageRegionIteratorWithIndex.h>\r
-#include <itkConstantBoundaryCondition.h>\r
-\r
-namespace itk\r
-{\r
-/** \class BinaryThinningImageFilter3D\r
-*\r
-* \brief This filter computes one-pixel-wide skeleton of a 3D input image.\r
-*\r
-* This class is parametrized over the type of the input image\r
-* and the type of the output image.\r
-* \r
-* The input is assumed to be a binary image. All non-zero valued voxels\r
-* are set to 1 internally to simplify the computation. The filter will\r
-* produce a skeleton of the object.  The output background values are 0,\r
-* and the foreground values are 1.\r
-* \r
-* A 26-neighbourhood configuration is used for the foreground and a\r
-* 6-neighbourhood configuration for the background. Thinning is performed\r
-* symmetrically in order to guarantee that the skeleton lies medial within\r
-* the object.\r
-*\r
-* This filter is a parallel thinning algorithm and is an implementation\r
-* of the algorithm described in:\r
-* \r
-* T.C. Lee, R.L. Kashyap, and C.N. Chu.\r
-* Building skeleton models via 3-D medial surface/axis thinning algorithms.\r
-* Computer Vision, Graphics, and Image Processing, 56(6):462--478, 1994.\r
-* \r
-* To do: Make use of multi-threading.\r
-*\r
-* \author Hanno Homann, Oxford University, Wolfson Medical Vision Lab, UK.\r
-* \r
-* \sa MorphologyImageFilter\r
-* \ingroup ImageEnhancement MathematicalMorphologyImageFilters\r
-*/\r
-\r
-template <class TInputImage,class TOutputImage>\r
-class BinaryThinningImageFilter3D :\r
-    public ImageToImageFilter<TInputImage,TOutputImage>\r
-{\r
-public:\r
-  /** Standard class typedefs. */\r
-  typedef BinaryThinningImageFilter3D    Self;\r
-  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;\r
-  typedef SmartPointer<Self> Pointer;\r
-  typedef SmartPointer<const Self> ConstPointer;\r
-\r
-  /** Method for creation through the object factory */\r
-  itkNewMacro(Self);\r
-\r
-  /** Run-time type information (and related methods). */\r
-  itkTypeMacro( BinaryThinningImageFilter3D, ImageToImageFilter );\r
-\r
-  /** Type for input image. */\r
-  typedef   TInputImage       InputImageType;\r
-\r
-  /** Type for output image: Skelenton of the object.  */\r
-  typedef   TOutputImage      OutputImageType;\r
-\r
-  /** Type for the region of the input image. */\r
-  typedef typename InputImageType::RegionType RegionType;\r
-\r
-  /** Type for the index of the input image. */\r
-  typedef typename RegionType::IndexType  IndexType;\r
-\r
-  /** Type for the pixel type of the input image. */\r
-  typedef typename InputImageType::PixelType InputImagePixelType ;\r
-\r
-  /** Type for the pixel type of the input image. */\r
-  typedef typename OutputImageType::PixelType OutputImagePixelType ;\r
-\r
-  /** Type for the size of the input image. */\r
-  typedef typename RegionType::SizeType SizeType;\r
-\r
-  /** Pointer Type for input image. */\r
-  typedef typename InputImageType::ConstPointer InputImagePointer;\r
-\r
-  /** Pointer Type for the output image. */\r
-  typedef typename OutputImageType::Pointer OutputImagePointer;\r
-  \r
-  /** Boundary condition type for the neighborhood iterator */\r
-  typedef ConstantBoundaryCondition< TInputImage > ConstBoundaryConditionType;\r
-  \r
-  /** Neighborhood iterator type */\r
-  typedef NeighborhoodIterator<TInputImage, ConstBoundaryConditionType> NeighborhoodIteratorType;\r
-  \r
-  /** Neighborhood type */\r
-  typedef typename NeighborhoodIteratorType::NeighborhoodType NeighborhoodType;\r
-\r
-  /** Get Skelenton by thinning image. */\r
-  OutputImageType * GetThinning(void);\r
-\r
-  /** ImageDimension enumeration   */\r
-  itkStaticConstMacro(InputImageDimension, unsigned int,\r
-                      TInputImage::ImageDimension );\r
-  itkStaticConstMacro(OutputImageDimension, unsigned int,\r
-                      TOutputImage::ImageDimension );\r
-\r
-#ifdef ITK_USE_CONCEPT_CHECKING\r
-  /** Begin concept checking */\r
-  itkConceptMacro(SameDimensionCheck,\r
-    (Concept::SameDimension<InputImageDimension, 3>));\r
-  itkConceptMacro(SameTypeCheck,\r
-    (Concept::SameType<InputImagePixelType, OutputImagePixelType>));\r
-  itkConceptMacro(InputAdditiveOperatorsCheck,\r
-    (Concept::AdditiveOperators<InputImagePixelType>));\r
-  itkConceptMacro(InputConvertibleToIntCheck,\r
-    (Concept::Convertible<InputImagePixelType, int>));\r
-  itkConceptMacro(IntConvertibleToInputCheck,\r
-    (Concept::Convertible<int, InputImagePixelType>));\r
-  itkConceptMacro(InputIntComparableCheck,\r
-    (Concept::Comparable<InputImagePixelType, int>));\r
-  /** End concept checking */\r
-#endif\r
-\r
-protected:\r
-  BinaryThinningImageFilter3D();\r
-  virtual ~BinaryThinningImageFilter3D() {};\r
-  void PrintSelf(std::ostream& os, Indent indent) const;\r
-\r
-  /** Compute thinning Image. */\r
-  void GenerateData();\r
-\r
-  /** Prepare data. */\r
-  void PrepareData();\r
-\r
-  /**  Compute thinning Image. */\r
-  void ComputeThinImage();\r
-  \r
-  /**  isEulerInvariant [Lee94] */\r
-  bool isEulerInvariant(NeighborhoodType neighbors, int *LUT);\r
-  void fillEulerLUT(int *LUT);  \r
-  /**  isSimplePoint [Lee94] */\r
-  bool isSimplePoint(NeighborhoodType neighbors);\r
-  /**  Octree_labeling [Lee94] */\r
-  void Octree_labeling(int octant, int label, int *cube);\r
-\r
-\r
-private:   \r
-  BinaryThinningImageFilter3D(const Self&); //purposely not implemented\r
-  void operator=(const Self&); //purposely not implemented\r
-\r
-}; // end of BinaryThinningImageFilter3D class\r
-\r
-} //end namespace itk\r
-\r
-#ifndef ITK_MANUAL_INSTANTIATION\r
-#include "itkBinaryThinningImageFilter3D.txx"\r
-#endif\r
-\r
-#endif\r
+#ifndef __itkBinaryThinningImageFilter3D_h
+#define __itkBinaryThinningImageFilter3D_h
+
+#include <itkNeighborhoodIterator.h>
+#include <itkImageToImageFilter.h>
+#include <itkImageRegionIteratorWithIndex.h>
+#include <itkConstantBoundaryCondition.h>
+
+namespace itk
+{
+/** \class BinaryThinningImageFilter3D
+*
+* \brief This filter computes one-pixel-wide skeleton of a 3D input image.
+*
+* This class is parametrized over the type of the input image
+* and the type of the output image.
+* 
+* The input is assumed to be a binary image. All non-zero valued voxels
+* are set to 1 internally to simplify the computation. The filter will
+* produce a skeleton of the object.  The output background values are 0,
+* and the foreground values are 1.
+* 
+* A 26-neighbourhood configuration is used for the foreground and a
+* 6-neighbourhood configuration for the background. Thinning is performed
+* symmetrically in order to guarantee that the skeleton lies medial within
+* the object.
+*
+* This filter is a parallel thinning algorithm and is an implementation
+* of the algorithm described in:
+* 
+* T.C. Lee, R.L. Kashyap, and C.N. Chu.
+* Building skeleton models via 3-D medial surface/axis thinning algorithms.
+* Computer Vision, Graphics, and Image Processing, 56(6):462--478, 1994.
+* 
+* To do: Make use of multi-threading.
+*
+* \author Hanno Homann, Oxford University, Wolfson Medical Vision Lab, UK.
+* 
+* \sa MorphologyImageFilter
+* \ingroup ImageEnhancement MathematicalMorphologyImageFilters
+*/
+
+template <class TInputImage,class TOutputImage>
+class BinaryThinningImageFilter3D :
+    public ImageToImageFilter<TInputImage,TOutputImage>
+{
+public:
+  /** Standard class typedefs. */
+  typedef BinaryThinningImageFilter3D    Self;
+  typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
+  typedef SmartPointer<Self> Pointer;
+  typedef SmartPointer<const Self> ConstPointer;
+
+  /** Method for creation through the object factory */
+  itkNewMacro(Self);
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro( BinaryThinningImageFilter3D, ImageToImageFilter );
+
+  /** Type for input image. */
+  typedef   TInputImage       InputImageType;
+
+  /** Type for output image: Skelenton of the object.  */
+  typedef   TOutputImage      OutputImageType;
+
+  /** Type for the region of the input image. */
+  typedef typename InputImageType::RegionType RegionType;
+
+  /** Type for the index of the input image. */
+  typedef typename RegionType::IndexType  IndexType;
+
+  /** Type for the pixel type of the input image. */
+  typedef typename InputImageType::PixelType InputImagePixelType ;
+
+  /** Type for the pixel type of the input image. */
+  typedef typename OutputImageType::PixelType OutputImagePixelType ;
+
+  /** Type for the size of the input image. */
+  typedef typename RegionType::SizeType SizeType;
+
+  /** Pointer Type for input image. */
+  typedef typename InputImageType::ConstPointer InputImagePointer;
+
+  /** Pointer Type for the output image. */
+  typedef typename OutputImageType::Pointer OutputImagePointer;
+  
+  /** Boundary condition type for the neighborhood iterator */
+  typedef ConstantBoundaryCondition< TInputImage > ConstBoundaryConditionType;
+  
+  /** Neighborhood iterator type */
+  typedef NeighborhoodIterator<TInputImage, ConstBoundaryConditionType> NeighborhoodIteratorType;
+  
+  /** Neighborhood type */
+  typedef typename NeighborhoodIteratorType::NeighborhoodType NeighborhoodType;
+
+  /** Get Skelenton by thinning image. */
+  OutputImageType * GetThinning(void);
+
+  /** ImageDimension enumeration   */
+  itkStaticConstMacro(InputImageDimension, unsigned int,
+                      TInputImage::ImageDimension );
+  itkStaticConstMacro(OutputImageDimension, unsigned int,
+                      TOutputImage::ImageDimension );
+
+#ifdef ITK_USE_CONCEPT_CHECKING
+  /** Begin concept checking */
+  itkConceptMacro(SameDimensionCheck,
+    (Concept::SameDimension<InputImageDimension, 3>));
+  itkConceptMacro(SameTypeCheck,
+    (Concept::SameType<InputImagePixelType, OutputImagePixelType>));
+  itkConceptMacro(InputAdditiveOperatorsCheck,
+    (Concept::AdditiveOperators<InputImagePixelType>));
+  itkConceptMacro(InputConvertibleToIntCheck,
+    (Concept::Convertible<InputImagePixelType, int>));
+  itkConceptMacro(IntConvertibleToInputCheck,
+    (Concept::Convertible<int, InputImagePixelType>));
+  itkConceptMacro(InputIntComparableCheck,
+    (Concept::Comparable<InputImagePixelType, int>));
+  /** End concept checking */
+#endif
+
+protected:
+  BinaryThinningImageFilter3D();
+  virtual ~BinaryThinningImageFilter3D() {};
+  void PrintSelf(std::ostream& os, Indent indent) const;
+
+  /** Compute thinning Image. */
+  void GenerateData();
+
+  /** Prepare data. */
+  void PrepareData();
+
+  /**  Compute thinning Image. */
+  void ComputeThinImage();
+  
+  /**  isEulerInvariant [Lee94] */
+  bool isEulerInvariant(NeighborhoodType neighbors, int *LUT);
+  void fillEulerLUT(int *LUT);  
+  /**  isSimplePoint [Lee94] */
+  bool isSimplePoint(NeighborhoodType neighbors);
+  /**  Octree_labeling [Lee94] */
+  void Octree_labeling(int octant, int label, int *cube);
+
+
+private:   
+  BinaryThinningImageFilter3D(const Self&); //purposely not implemented
+  void operator=(const Self&); //purposely not implemented
+
+}; // end of BinaryThinningImageFilter3D class
+
+} //end namespace itk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "itkBinaryThinningImageFilter3D.txx"
+#endif
+
+#endif