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