Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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-2013 UJF-Grenoble 1, 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 {
41 
54 template <class TInputImage >
55 class ITK_EXPORT ImageToVTKImageFilter : public ProcessObject
56 {
57 public:
60  typedef ProcessObject Superclass;
61  typedef SmartPointer<Self> Pointer;
62  typedef SmartPointer<const Self> ConstPointer;
63 
65  itkNewMacro(Self);
66 
68  itkTypeMacro(ImageToVTKImageFilter, ProcessObject);
69 
71  typedef TInputImage InputImageType;
72  typedef typename InputImageType::ConstPointer InputImagePointer;
73  typedef VTKImageExport< InputImageType> ExporterFilterType;
74  typedef typename ExporterFilterType::Pointer ExporterFilterPointer;
75 
78  vtkSmartPointer<vtkImageData> GetOutput() const;
79 
81  void SetInput( const InputImageType * );
82 
86  vtkSmartPointer<vtkImageImport> GetImporter() const;
87 
91  ExporterFilterType * GetExporter() const;
92 
94  void Update();
95 
96  const std::vector<double>& getvtest() const
97  {
98  return m_vtest;
99  }
100 
101  int testsize()
102  {
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  {
114  m_vtest.push_back(toto);
115  return m_vtest;
116  }
117  std::vector<double> tralala()
118  {
119  std::vector<double> w;
120  for (double i=0; i<10; i++)
121  w.push_back(i);
122  return w;
123 
124  }
125 
126 protected:
128  virtual ~ImageToVTKImageFilter();
129 
130 private:
131  ImageToVTKImageFilter(const Self&); //purposely not implemented
132  void operator=(const Self&); //purposely not implemented
133 
135  vtkSmartPointer<vtkImageImport> m_Importer;
136  std::vector<double> m_vtest;
137 };
138 
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "itkImageToVTKImageFilter.txx"
143 #endif
144 
145 #endif
146 
147 
148