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 //:public clitk::FilterBase
49 /** Standard class typedefs. */
50 // typedef itk::ImageToMeshFilter<ImageType, vtkPolyData> Superclass;
51 typedef itk::ProcessObject Superclass;
52 typedef BinaryImageToMeshFilter Self;
53 typedef itk::SmartPointer<Self> Pointer;
54 typedef itk::SmartPointer<const Self> ConstPointer;
56 /** Method for creation through the object factory. */
59 /** Run-time type information (and related methods). */
60 itkTypeMacro(BinaryImageToMeshFilter, Superclass);
62 /** ImageDimension constants */
63 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
65 // /** Some convenient typedefs. */
66 // typedef typename ImageType::ConstPointer ImageConstPointer;
67 typedef typename ImageType::Pointer ImagePointer;
68 // typedef typename ImageType::RegionType RegionType;
69 typedef typename ImageType::PixelType PixelType;
70 // typedef typename ImageType::SpacingType SpacingType;
71 // typedef typename ImageType::SizeType SizeType;
72 // typedef typename ImageType::PointType PointType;
73 //typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
74 // typedef vtkSmartPointer<vtkPolyData> DataObjectPointer;
76 // using Superclass::SetInput;
77 // void SetInput(unsigned int idx, const ImageType *input);
78 // void SetInput(const ImageType *input)
80 // m_this->SetInput(0, input);
83 // const ImageType * GetInput(unsigned int idx);
84 // const ImageType * GetInput()
86 // return this->GetInput(0);
89 //virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
90 // virtual void GenerateData();
91 // virtual void GenerateOutputInformation();
93 /** Input : initial image and object */
94 // itkSetMacro(Mesh, vtkSmartPointer<vtkPolyData>);
95 // itkGetConstMacro(Mesh, vtkSmartPointer<vtkPolyData>);
97 // itkSetMacro(LikeImage, ImagePointer);
98 // itkGetConstMacro(LikeImage, ImagePointer);
100 // itkSetMacro(Extrude, bool);
101 // itkGetMacro(Extrude, bool);
102 // itkBooleanMacro(Extrude);
103 itkSetMacro(Input, ImagePointer);
104 itkGetConstMacro(Input, ImagePointer);
105 itkGetMacro(OutputMesh, vtkSmartPointer<vtkPolyData>);
107 // virtual void GenerateOutputInformation();
108 virtual void Update();
111 BinaryImageToMeshFilter();
112 virtual ~BinaryImageToMeshFilter() {}
114 ImagePointer m_Input;
115 vtkSmartPointer<vtkPolyData> m_OutputMesh;
118 BinaryImageToMeshFilter(const Self&); //purposely not implemented
119 void operator=(const Self&); //purposely not implemented
122 //--------------------------------------------------------------------
124 } // end namespace clitk
125 //--------------------------------------------------------------------
127 #ifndef ITK_MANUAL_INSTANTIATION
128 #include "clitkBinaryImageToMeshFilter.txx"