]> Creatis software - clitk.git/blob - itk/itkVTKImageToImageFilter.h
again
[clitk.git] / itk / itkVTKImageToImageFilter.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 __itkVTKImageToImageFilter_h\r
15 #define __itkVTKImageToImageFilter_h\r
16 \r
17 #include "itkVTKImageImport.h"\r
18 #include "vtkImageExport.h"\r
19 #include "vtkImageData.h"\r
20 \r
21 #ifndef vtkFloatingPointType\r
22 #define vtkFloatingPointType float\r
23 #endif\r
24 \r
25 namespace itk\r
26 {\r
27 \r
28 /** \class VTKImageToImageFilter\r
29  * \brief Converts a VTK image into an ITK image and plugs a\r
30  *  vtk data pipeline to an ITK datapipeline.\r
31  *\r
32  *  This class puts together an itkVTKImageImporter and a vtkImageExporter.\r
33  *  It takes care of the details related to the connection of ITK and VTK\r
34  *  pipelines. The User will perceive this filter as an adaptor to which\r
35  *  a vtkImage can be plugged as input and an itk::Image is produced as\r
36  *  output.\r
37  *\r
38  * \ingroup   ImageFilters\r
39  */\r
40 template <class TOutputImage >\r
41 class ITK_EXPORT VTKImageToImageFilter : public ProcessObject\r
42 {\r
43 public:\r
44     /** Standard class typedefs. */\r
45     typedef VTKImageToImageFilter       Self;\r
46     typedef ProcessObject             Superclass;\r
47     typedef SmartPointer<Self>        Pointer;\r
48     typedef SmartPointer<const Self>  ConstPointer;\r
49 \r
50     /** Method for creation through the object factory. */\r
51     itkNewMacro(Self);\r
52 \r
53     /** Run-time type information (and related methods). */\r
54     itkTypeMacro(VTKImageToImageFilter, ProcessObject);\r
55 \r
56     /** Some typedefs. */\r
57     typedef TOutputImage OutputImageType;\r
58     typedef typename    OutputImageType::ConstPointer    OutputImagePointer;\r
59     typedef VTKImageImport< OutputImageType >   ImporterFilterType;\r
60     typedef typename ImporterFilterType::Pointer         ImporterFilterPointer;\r
61 \r
62     /** Get the output in the form of a vtkImage.\r
63         This call is delegated to the internal vtkImageImporter filter  */\r
64     const OutputImageType *  GetOutput() const;\r
65 \r
66     /** Set the input in the form of a vtkImageData */\r
67     void SetInput( vtkImageData * );\r
68 \r
69     /** Return the internal VTK image exporter filter.\r
70         This is intended to facilitate users the access\r
71         to methods in the exporter */\r
72     vtkImageExport * GetExporter() const;\r
73 \r
74     /** Return the internal ITK image importer filter.\r
75         This is intended to facilitate users the access\r
76         to methods in the importer */\r
77     ImporterFilterType * GetImporter() const;\r
78 \r
79     /** This call delegate the update to the importer */\r
80     void Update();\r
81 \r
82 protected:\r
83     VTKImageToImageFilter();\r
84     virtual ~VTKImageToImageFilter();\r
85 \r
86 private:\r
87     VTKImageToImageFilter(const Self&); //purposely not implemented\r
88     void operator=(const Self&); //purposely not implemented\r
89 \r
90     ImporterFilterPointer       m_Importer;\r
91     vtkImageExport            * m_Exporter;\r
92 \r
93 };\r
94 \r
95 } // end namespace itk\r
96 \r
97 #ifndef ITK_MANUAL_INSTANTIATION\r
98 #include "itkVTKImageToImageFilter.txx"\r
99 #endif\r
100 \r
101 #endif\r
102 \r
103 \r
104 \r