]> Creatis software - creaImageIO.git/blob - src/itkImageToVTKImageFilter.h
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / src / itkImageToVTKImageFilter.h
1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageToVTKImageFilter.h,v $
5   Language:  C++
6   Date:      $Date: 2012/11/15 12:45:28 $
7   Version:   $Revision: 1.2 $
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 #include <vector>
24
25 namespace itk
26 {
27   
28 /** \class ImageToVTKImageFilter
29  * \brief Converts an ITK image into a VTK image and plugs a 
30  *  itk data pipeline to a VTK datapipeline.   
31  *
32  *  This class puts together an itkVTKImageExporter and a vtkImageImporter.
33  *  It takes care of the details related to the connection of ITK and VTK
34  *  pipelines. The User will perceive this filter as an adaptor to which
35  *  an itk::Image can be plugged as input and a vtkImage is produced as 
36  *  output.
37  * 
38  * \ingroup   ImageFilters     
39  */
40 template <class TInputImage >
41 class ITK_EXPORT ImageToVTKImageFilter : public ProcessObject
42 {
43 public:
44   /** Standard class typedefs. */
45   typedef ImageToVTKImageFilter       Self;
46   typedef ProcessObject             Superclass;
47   typedef SmartPointer<Self>        Pointer;
48   typedef SmartPointer<const Self>  ConstPointer;
49
50   /** Method for creation through the object factory. */
51   itkNewMacro(Self);
52   
53   /** Run-time type information (and related methods). */
54   itkTypeMacro(ImageToVTKImageFilter, ProcessObject);
55
56   /** Some typedefs. */
57   typedef TInputImage InputImageType;
58   typedef typename    InputImageType::ConstPointer    InputImagePointer;
59   typedef VTKImageExport< InputImageType>            ExporterFilterType; 
60   typedef typename ExporterFilterType::Pointer        ExporterFilterPointer;
61  
62   /** Get the output in the form of a vtkImage. 
63       This call is delegated to the internal vtkImageImporter filter  */
64   vtkImageData *  GetOutput() const;
65
66   /** Set the input in the form of an itk::Image */
67   void SetInput( const InputImageType * );
68
69   /** Return the internal VTK image importer filter.
70       This is intended to facilitate users the access 
71       to methods in the importer */
72   vtkImageImport * GetImporter() const;
73
74   /** Return the internal ITK image exporter filter.
75       This is intended to facilitate users the access 
76       to methods in the exporter */
77   ExporterFilterType * GetExporter() const;
78   
79   /** This call delegate the update to the importer */
80   void Update();
81   
82
83
84    
85 protected:
86   ImageToVTKImageFilter(); 
87   virtual ~ImageToVTKImageFilter(); 
88
89 private:
90   ImageToVTKImageFilter(const Self&); //purposely not implemented
91   void operator=(const Self&); //purposely not implemented
92
93   ExporterFilterPointer       m_Exporter;
94   vtkImageImport            * m_Importer;
95    std::vector<double> m_vtest;
96 };
97
98 } // end namespace itk
99
100 #ifndef ITK_MANUAL_INSTANTIATION
101 #include "itkImageToVTKImageFilter.txx"
102 #endif
103
104 #endif
105
106
107