CustusX  2021.11.29-dev+develop.644e4
An IGT application
itkImageToVTKImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkImageToVTKImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2006-10-18 13:55:58 $
7  Version: $Revision: 1.3 $
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 
40 template <class TInputImage >
41 class ITK_EXPORT ImageToVTKImageFilter : public ProcessObject
42 {
43 public:
46  typedef ProcessObject Superclass;
47  typedef SmartPointer<Self> Pointer;
48  typedef SmartPointer<const Self> ConstPointer;
49 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(ImageToVTKImageFilter, ProcessObject);
55 
57  typedef TInputImage InputImageType;
58  typedef typename InputImageType::ConstPointer InputImagePointer;
59  typedef VTKImageExport< InputImageType> ExporterFilterType;
60  typedef typename ExporterFilterType::Pointer ExporterFilterPointer;
61 
64  vtkImageData * GetOutput() const;
65 
67  void SetInput( const InputImageType * );
68 
72  vtkImageImport * GetImporter() const;
73 
77  ExporterFilterType * GetExporter() const;
78 
80  void Update();
81 
82  const std::vector<double>& getvtest() const
83  {
84  return m_vtest;
85  }
86 
87  int testsize()
88  {
89  return m_vtest.size();
90  }
91 
92  std::vector<double> addvector(const std::vector<double>& v) {
93  for (unsigned int i=0; i<v.size(); i++)
94  m_vtest.push_back(v[i]);
95  return m_vtest;
96  }
97 
98  const std::vector<double>& addtest(double toto)
99  {
100  m_vtest.push_back(toto);
101  return m_vtest;
102  }
103  std::vector<double> tralala()
104  {
105  std::vector<double> w;
106  for (double i=0; i<10; i++)
107  w.push_back(i);
108  return w;
109 
110  }
111 
112 protected:
114  virtual ~ImageToVTKImageFilter();
115 
116 private:
117  ImageToVTKImageFilter(const Self&); //purposely not implemented
118  void operator=(const Self&); //purposely not implemented
119 
120  ExporterFilterPointer m_Exporter;
121  vtkImageImport * m_Importer;
122  std::vector<double> m_vtest;
123 };
124 
125 } // end namespace itk
126 
127 #ifndef ITK_MANUAL_INSTANTIATION
128 #include "itkImageToVTKImageFilter.txx"
129 #endif
130 
131 #endif
132 
133 
134 
VTKImageExport< InputImageType > ExporterFilterType
std::vector< double > addvector(const std::vector< double > &v)
InputImageType::ConstPointer InputImagePointer
Converts an ITK image into a VTK image and plugs a itk data pipeline to a VTK datapipeline.
const std::vector< double > & getvtest() const
const std::vector< double > & addtest(double toto)
ExporterFilterType::Pointer ExporterFilterPointer
SmartPointer< const Self > ConstPointer