Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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-2014 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 
58 template <class TInputImage >
59 class ITK_EXPORT ImageToVTKImageFilter : public ProcessObject
60 {
61 public:
64  typedef ProcessObject Superclass;
65  typedef SmartPointer<Self> Pointer;
66  typedef SmartPointer<const Self> ConstPointer;
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(ImageToVTKImageFilter, ProcessObject);
73 
75  typedef TInputImage InputImageType;
76  typedef typename InputImageType::ConstPointer InputImagePointer;
77  typedef VTKImageExport< InputImageType> ExporterFilterType;
78  typedef typename ExporterFilterType::Pointer ExporterFilterPointer;
79 
82  vtkSmartPointer<vtkImageData> GetOutput() const;
83 
85  void SetInput( const InputImageType * );
86 
90  vtkSmartPointer<vtkImageImport> GetImporter() const;
91 
95  ExporterFilterType * GetExporter() const;
96 
98  void Update();
99 
100  const std::vector<double>& getvtest() const
101  {
102  return m_vtest;
103  }
104 
105  int testsize()
106  {
107  return m_vtest.size();
108  }
109 
110  std::vector<double> addvector(const std::vector<double>& v) {
111  for (unsigned int i=0; i<v.size(); i++)
112  m_vtest.push_back(v[i]);
113  return m_vtest;
114  }
115 
116  const std::vector<double>& addtest(double toto)
117  {
118  m_vtest.push_back(toto);
119  return m_vtest;
120  }
121  std::vector<double> tralala()
122  {
123  std::vector<double> w;
124  for (double i=0; i<10; i++)
125  w.push_back(i);
126  return w;
127 
128  }
129 
130 protected:
132  virtual ~ImageToVTKImageFilter();
133 
134 private:
135  ImageToVTKImageFilter(const Self&); //purposely not implemented
136  void operator=(const Self&); //purposely not implemented
137 
139  vtkSmartPointer<vtkImageImport> m_Importer;
140  std::vector<double> m_vtest;
141 };
142 
143 } // end namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 #include "itkImageToVTKImageFilter.txx"
147 #endif
148 
149 #endif
150 
151 
152 
VTKImageExport< InputImageType > ExporterFilterType
Definition: itkImageToVTKImageFilter.h:77
InputImageType::ConstPointer InputImagePointer
Definition: itkImageToVTKImageFilter.h:76
const std::vector< double > & addtest(double toto)
Definition: itkImageToVTKImageFilter.h:116
SmartPointer< const Self > ConstPointer
Definition: itkImageToVTKImageFilter.h:66
ImageToVTKImageFilter Self
Standard class typedefs.
Definition: itkImageToVTKImageFilter.h:63
std::vector< double > tralala()
Definition: itkImageToVTKImageFilter.h:121
ProcessObject Superclass
Definition: itkImageToVTKImageFilter.h:64
SmartPointer< Self > Pointer
Definition: itkImageToVTKImageFilter.h:65
ExporterFilterType::Pointer ExporterFilterPointer
Definition: itkImageToVTKImageFilter.h:78
std::vector< double > m_vtest
Definition: itkImageToVTKImageFilter.h:140
Converts an ITK image into a VTK image and plugs a itk data pipeline to a VTK datapipeline.
Definition: itkImageToVTKImageFilter.h:59
int testsize()
Definition: itkImageToVTKImageFilter.h:105
std::vector< double > addvector(const std::vector< double > &v)
Definition: itkImageToVTKImageFilter.h:110
ExporterFilterPointer m_Exporter
Definition: itkImageToVTKImageFilter.h:138
vtkSmartPointer< vtkImageImport > m_Importer
Definition: itkImageToVTKImageFilter.h:139
TInputImage InputImageType
Some typedefs.
Definition: itkImageToVTKImageFilter.h:75
const std::vector< double > & getvtest() const
Definition: itkImageToVTKImageFilter.h:100