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 CLITKMESHTOBINARYIMAGEFILTER_H
20 #define CLITKMESHTOBINARYIMAGEFILTER_H
23 #include "clitkCommon.h"
26 #include <itkImageSource.h>
29 #include <vtkSmartPointer.h>
30 #include <vtkPolyData.h>
34 /* --------------------------------------------------------------------
35 Convert a mesh composed of a list of 2D contours, into a 3D binray
37 -------------------------------------------------------------------- */
39 template <class ImageType>
40 class ITK_EXPORT MeshToBinaryImageFilter: public itk::ImageSource<ImageType>
44 /** Standard class typedefs. */
45 typedef itk::ImageSource<ImageType> Superclass;
46 typedef MeshToBinaryImageFilter Self;
47 typedef itk::SmartPointer<Self> Pointer;
48 typedef itk::SmartPointer<const Self> ConstPointer;
50 /** Method for creation through the object factory. */
53 /** Run-time type information (and related methods). */
54 itkTypeMacro(MeshToBinaryImageFilter, Superclass);
56 /** ImageDimension constants */
57 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
58 typedef itk::Image<float, ImageDimension> FloatImageType;
60 /** Some convenient typedefs. */
61 typedef typename ImageType::ConstPointer ImageConstPointer;
62 typedef typename ImageType::Pointer ImagePointer;
63 typedef typename ImageType::RegionType RegionType;
64 typedef typename ImageType::PixelType PixelType;
65 typedef typename ImageType::SpacingType SpacingType;
66 typedef typename ImageType::SizeType SizeType;
67 typedef typename ImageType::PointType PointType;
68 typedef itk::Image<PixelType, ImageDimension-1> SliceType;
70 /** Input : initial image and object */
71 itkSetMacro(Mesh, vtkSmartPointer<vtkPolyData>);
72 itkGetConstMacro(Mesh, vtkSmartPointer<vtkPolyData>);
74 itkSetMacro(LikeImage, ImagePointer);
75 itkGetConstMacro(LikeImage, ImagePointer);
77 itkSetMacro(Extrude, bool);
78 itkGetMacro(Extrude, bool);
81 MeshToBinaryImageFilter();
82 virtual ~MeshToBinaryImageFilter() {}
84 virtual void GenerateOutputInformation();
85 virtual void GenerateData();
88 ImagePointer m_LikeImage;
89 vtkSmartPointer<vtkPolyData> m_Mesh;
92 MeshToBinaryImageFilter(const Self&); //purposely not implemented
93 void operator=(const Self&); //purposely not implemented
96 //--------------------------------------------------------------------
98 } // end namespace clitk
99 //--------------------------------------------------------------------
101 #ifndef ITK_MANUAL_INSTANTIATION
102 #include "clitkMeshToBinaryImageFilter.txx"