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