]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/itkImageToVTKImageFilter.h
b3a4df834759e40cf940544f6d416c20f4432f24
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / itkImageToVTKImageFilter.h
1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageToVTKImageFilter.h,v $
5   Language:  C++
6   Date:      $Date: 2009/03/30 12:58:41 $
7   Version:   $Revision: 1.1 $
8
9   Copyright (c) 2002 Insight Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkImageToVTKImageFilter_h
18 #define __itkImageToVTKImageFilter_h
19
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
102
103