]> Creatis software - clitk.git/blob - itk/clitkBinaryImageToMeshFilter.h
First Modification for Qt5 & VTK6
[clitk.git] / itk / clitkBinaryImageToMeshFilter.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ======================================================================-====*/
18
19 #ifndef CLITKBINARYIMAGETOMESHFILTER_H
20 #define CLITKBINARYIMAGETOMESHFILTER_H
21
22 // clitk
23 #include "clitkCommon.h"
24 #include "vvFromITK.h"
25
26 // itk
27 #include <itkProcessObject.h>
28
29 // vtk
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>
37
38 namespace clitk {
39     
40   /* --------------------------------------------------------------------     
41      Convert a 3D binary image into a list of 2D contours (vtkpolydata)
42      -------------------------------------------------------------------- */
43   
44   template<class ImageType>
45   class ITK_EXPORT BinaryImageToMeshFilter:public itk::Object
46   {
47
48   public:
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;
54        
55     /** Method for creation through the object factory. */
56     itkNewMacro(Self);
57  
58     /** Run-time type information (and related methods). */
59     itkTypeMacro(BinaryImageToMeshFilter, Superclass);
60
61     /** ImageDimension constants */
62     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
63
64     // /** Some convenient typedefs. */
65     typedef typename ImageType::Pointer      ImagePointer;
66     typedef typename ImageType::PixelType    PixelType;
67
68     itkSetMacro(Input, ImagePointer);
69     itkGetConstMacro(Input, ImagePointer);
70     itkGetMacro(OutputMesh, vtkSmartPointer<vtkPolyData>);
71     itkSetMacro(ThresholdValue, PixelType);
72
73     virtual void Update();
74
75   protected:
76     BinaryImageToMeshFilter();
77     virtual ~BinaryImageToMeshFilter() {}
78     
79     ImagePointer m_Input;
80     vtkSmartPointer<vtkPolyData> m_OutputMesh;
81     PixelType m_ThresholdValue;
82
83   private:
84     BinaryImageToMeshFilter(const Self&); //purposely not implemented
85     void operator=(const Self&); //purposely not implemented
86     
87   }; // end class
88   //--------------------------------------------------------------------
89
90 } // end namespace clitk
91 //--------------------------------------------------------------------
92
93 #ifndef ITK_MANUAL_INSTANTIATION
94 #include "clitkBinaryImageToMeshFilter.txx"
95 #endif
96
97 #endif