Computer Assited Medical Intervention Tool Kit  version 4.0
itkImageToVTKImageFilter.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 #ifndef __itkImageToVTKImageFilter_h
26 #define __itkImageToVTKImageFilter_h
27 
28 // -- itk stuff
29 #include "itkVTKImageExport.h"
30 
31 // -- vtk stuff
32 #include "vtkImageImport.h"
33 #include "vtkImageData.h"
34 #include "vtkSmartPointer.h"
35 
36 // -- stl stuff
37 #include <vector>
38 
39 namespace itk {
40 
57 template <class TInputImage >
58 class ITK_EXPORT ImageToVTKImageFilter : public ProcessObject {
59 public:
62  typedef ProcessObject Superclass;
63  typedef SmartPointer<Self> Pointer;
64  typedef SmartPointer<const Self> ConstPointer;
65 
67  itkNewMacro(Self);
68 
70  itkTypeMacro(ImageToVTKImageFilter, ProcessObject);
71 
73  typedef TInputImage InputImageType;
74  typedef typename InputImageType::ConstPointer InputImagePointer;
75  typedef VTKImageExport< InputImageType> ExporterFilterType;
76  typedef typename ExporterFilterType::Pointer ExporterFilterPointer;
77 
80  vtkSmartPointer<vtkImageData> GetOutput() const;
81 
83  void SetInput( const InputImageType * );
84 
88  vtkSmartPointer<vtkImageImport> GetImporter() const;
89 
93  ExporterFilterType * GetExporter() const;
94 
96  void Update();
97 
98  const std::vector<double>& getvtest() const {
99  return m_vtest;
100  }
101 
102  int testsize() {
103  return m_vtest.size();
104  }
105 
106  std::vector<double> addvector(const std::vector<double>& v) {
107  for (unsigned int i=0; i<v.size(); i++)
108  m_vtest.push_back(v[i]);
109  return m_vtest;
110  }
111 
112  const std::vector<double>& addtest(double toto) {
113  m_vtest.push_back(toto);
114  return m_vtest;
115  }
116  std::vector<double> tralala() {
117  std::vector<double> w;
118  for (double i=0; i<10; i++)
119  w.push_back(i);
120  return w;
121 
122  }
123 
124 protected:
126  virtual ~ImageToVTKImageFilter();
127 
128 private:
129  ImageToVTKImageFilter(const Self&); //purposely not implemented
130  void operator=(const Self&); //purposely not implemented
131 
132  ExporterFilterPointer m_Exporter;
133  vtkSmartPointer<vtkImageImport> m_Importer;
134  std::vector<double> m_vtest;
135 };
136 
137 } // end namespace itk
138 
139 #ifndef ITK_MANUAL_INSTANTIATION
140 #include "itkImageToVTKImageFilter.txx"
141 #endif
142 
143 #endif
144 
145 
146 
const std::vector< double > & getvtest() const
Definition: itkImageToVTKImageFilter.h:98
VTKImageExport< InputImageType > ExporterFilterType
Definition: itkImageToVTKImageFilter.h:75
InputImageType::ConstPointer InputImagePointer
Definition: itkImageToVTKImageFilter.h:74
Definition: itkImageToVTKImageFilter.h:39
const std::vector< double > & addtest(double toto)
Definition: itkImageToVTKImageFilter.h:112
SmartPointer< const Self > ConstPointer
Definition: itkImageToVTKImageFilter.h:64
ImageToVTKImageFilter Self
Standard class typedefs.
Definition: itkImageToVTKImageFilter.h:61
std::vector< double > tralala()
Definition: itkImageToVTKImageFilter.h:116
ProcessObject Superclass
Definition: itkImageToVTKImageFilter.h:62
SmartPointer< Self > Pointer
Definition: itkImageToVTKImageFilter.h:63
ExporterFilterType::Pointer ExporterFilterPointer
Definition: itkImageToVTKImageFilter.h:76
std::vector< double > m_vtest
Definition: itkImageToVTKImageFilter.h:134
Converts an ITK image into a VTK image and plugs a itk data pipeline to a VTK datapipeline.
Definition: itkImageToVTKImageFilter.h:58
int testsize()
Definition: itkImageToVTKImageFilter.h:102
std::vector< double > addvector(const std::vector< double > &v)
Definition: itkImageToVTKImageFilter.h:106
ExporterFilterPointer m_Exporter
Definition: itkImageToVTKImageFilter.h:132
vtkSmartPointer< vtkImageImport > m_Importer
Definition: itkImageToVTKImageFilter.h:133
TInputImage InputImageType
Some typedefs.
Definition: itkImageToVTKImageFilter.h:73