1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
19 #ifndef CLITKBINARYIMAGETOMESHFILTER_H
20 #define CLITKMESHTOBINARYIMAGEFILTER_H
23 #include "clitkCommon.h"
24 #include "vvFromITK.h"
27 #include <itkProcessObject.h>
30 #include <vtkSmartPointer.h>
31 #include <vtkPolyData.h>
32 #include <vtkImageClip.h>
33 #include <vtkMarchingSquares.h>
34 #include <vtkAppendPolyData.h>
35 #include <vtkDecimatePro.h>
36 #include <vtkStripper.h>
40 /* --------------------------------------------------------------------
41 Convert a 3D binary image into a list of 2D contours (vtkpolydata)
42 -------------------------------------------------------------------- */
44 template<class ImageType>
45 class ITK_EXPORT BinaryImageToMeshFilter:public itk::Object
49 /** Standard class typedefs. */
50 typedef itk::ProcessObject Superclass;
51 typedef BinaryImageToMeshFilter Self;
52 typedef itk::SmartPointer<Self> Pointer;
53 typedef itk::SmartPointer<const Self> ConstPointer;
55 /** Method for creation through the object factory. */
58 /** Run-time type information (and related methods). */
59 itkTypeMacro(BinaryImageToMeshFilter, Superclass);
61 /** ImageDimension constants */
62 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
64 // /** Some convenient typedefs. */
65 typedef typename ImageType::Pointer ImagePointer;
66 typedef typename ImageType::PixelType PixelType;
68 itkSetMacro(Input, ImagePointer);
69 itkGetConstMacro(Input, ImagePointer);
70 itkGetMacro(OutputMesh, vtkSmartPointer<vtkPolyData>);
71 itkSetMacro(ThresholdValue, PixelType);
73 virtual void Update();
76 BinaryImageToMeshFilter();
77 virtual ~BinaryImageToMeshFilter() {}
80 vtkSmartPointer<vtkPolyData> m_OutputMesh;
81 PixelType m_ThresholdValue;
84 BinaryImageToMeshFilter(const Self&); //purposely not implemented
85 void operator=(const Self&); //purposely not implemented
88 //--------------------------------------------------------------------
90 } // end namespace clitk
91 //--------------------------------------------------------------------
93 #ifndef ITK_MANUAL_INSTANTIATION
94 #include "clitkBinaryImageToMeshFilter.txx"