]> Creatis software - clitk.git/blob - itk/itkImageToVTKImageFilter.h
38baed895f7b7d21165ea60c792d2848b463908f
[clitk.git] / itk / itkImageToVTKImageFilter.h
1 /*=========================================================================\r
2 \r
3   Program:   Insight Segmentation & Registration Toolkit\r
4   Language:  C++\r
5 \r
6   Copyright (c) 2002 Insight Consortium. All rights reserved.\r
7   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.\r
8 \r
9      This software is distributed WITHOUT ANY WARRANTY; without even\r
10      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
11      PURPOSE.  See the above copyright notices for more information.\r
12 \r
13 =========================================================================*/\r
14 #ifndef __itkImageToVTKImageFilter_h\r
15 #define __itkImageToVTKImageFilter_h\r
16 \r
17 #include "itkVTKImageExport.h"\r
18 #include "vtkImageImport.h"\r
19 #include "vtkImageData.h"\r
20 \r
21 namespace itk\r
22 {\r
23 \r
24 /** \class ImageToVTKImageFilter\r
25  * \brief Converts an ITK image into a VTK image and plugs a\r
26  *  itk data pipeline to a VTK datapipeline.\r
27  *\r
28  *  This class puts together an itkVTKImageExporter and a vtkImageImporter.\r
29  *  It takes care of the details related to the connection of ITK and VTK\r
30  *  pipelines. The User will perceive this filter as an adaptor to which\r
31  *  an itk::Image can be plugged as input and a vtkImage is produced as\r
32  *  output.\r
33  *\r
34  * \ingroup   ImageFilters\r
35  */\r
36 template <class TInputImage >\r
37 class ITK_EXPORT ImageToVTKImageFilter : public ProcessObject\r
38 {\r
39 public:\r
40     /** Standard class typedefs. */\r
41     typedef ImageToVTKImageFilter       Self;\r
42     typedef ProcessObject             Superclass;\r
43     typedef SmartPointer<Self>        Pointer;\r
44     typedef SmartPointer<const Self>  ConstPointer;\r
45 \r
46     /** Method for creation through the object factory. */\r
47     itkNewMacro(Self);\r
48 \r
49     /** Run-time type information (and related methods). */\r
50     itkTypeMacro(ImageToVTKImageFilter, ProcessObject);\r
51 \r
52     /** Some typedefs. */\r
53     typedef TInputImage InputImageType;\r
54     typedef typename    InputImageType::ConstPointer    InputImagePointer;\r
55     typedef VTKImageExport< InputImageType>            ExporterFilterType;\r
56     typedef typename ExporterFilterType::Pointer        ExporterFilterPointer;\r
57 \r
58     /** Get the output in the form of a vtkImage.\r
59         This call is delegated to the internal vtkImageImporter filter  */\r
60     vtkImageData *  GetOutput() const;\r
61 \r
62     /** Set the input in the form of an itk::Image */\r
63     void SetInput( const InputImageType * );\r
64 \r
65     /** Return the internal VTK image importer filter.\r
66         This is intended to facilitate users the access\r
67         to methods in the importer */\r
68     vtkImageImport * GetImporter() const;\r
69 \r
70     /** Return the internal ITK image exporter filter.\r
71         This is intended to facilitate users the access\r
72         to methods in the exporter */\r
73     ExporterFilterType * GetExporter() const;\r
74 \r
75     /** This call delegate the update to the importer */\r
76     void Update();\r
77 \r
78 protected:\r
79     ImageToVTKImageFilter();\r
80     virtual ~ImageToVTKImageFilter();\r
81 \r
82 private:\r
83     ImageToVTKImageFilter(const Self&); //purposely not implemented\r
84     void operator=(const Self&); //purposely not implemented\r
85 \r
86     ExporterFilterPointer       m_Exporter;\r
87     vtkImageImport            * m_Importer;\r
88 \r
89 };\r
90 \r
91 } // end namespace itk\r
92 \r
93 #ifndef ITK_MANUAL_INSTANTIATION\r
94 #include "itkImageToVTKImageFilter.txx"\r
95 #endif\r
96 \r
97 #endif\r
98 \r
99 \r
100 \r