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