]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/itkImageToVTKImageFilter.txx
Fixed the bug with the Ubuntu 64 latest version, by modifying the
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / itkImageToVTKImageFilter.txx
1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageToVTKImageFilter.txx,v $
5   Language:  C++
6   Date:      $Date: 2012/01/09 16:49:09 $
7   Version:   $Revision: 1.2 $
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_txx
18 #define _itkImageToVTKImageFilter_txx
19 #include "itkImageToVTKImageFilter.h"
20
21 namespace itk
22 {
23
24
25 /**
26  * Constructor
27  */
28 template <class TInputImage>
29 ImageToVTKImageFilter<TInputImage>
30 ::ImageToVTKImageFilter()
31 {
32
33   m_Importer = vtkImageImport::New();
34
35   m_Exporter = ExporterFilterType::New();
36
37   m_Importer->SetUpdateInformationCallback(m_Exporter->GetUpdateInformationCallback());
38   m_Importer->SetPipelineModifiedCallback(m_Exporter->GetPipelineModifiedCallback());
39   m_Importer->SetWholeExtentCallback(m_Exporter->GetWholeExtentCallback());
40   m_Importer->SetSpacingCallback(m_Exporter->GetSpacingCallback());
41   m_Importer->SetOriginCallback(m_Exporter->GetOriginCallback());
42   m_Importer->SetScalarTypeCallback(m_Exporter->GetScalarTypeCallback());
43   m_Importer->SetNumberOfComponentsCallback(m_Exporter->GetNumberOfComponentsCallback());
44   m_Importer->SetPropagateUpdateExtentCallback(m_Exporter->GetPropagateUpdateExtentCallback());
45   m_Importer->SetUpdateDataCallback(m_Exporter->GetUpdateDataCallback());
46   m_Importer->SetDataExtentCallback(m_Exporter->GetDataExtentCallback());
47   m_Importer->SetBufferPointerCallback(m_Exporter->GetBufferPointerCallback());
48   m_Importer->SetCallbackUserData(m_Exporter->GetCallbackUserData());
49
50 }
51
52
53
54
55 /**
56  * Destructor
57  */
58 template <class TInputImage>
59 ImageToVTKImageFilter<TInputImage>
60 ::~ImageToVTKImageFilter()
61 {
62   if( m_Importer )
63     {
64     m_Importer->Delete();
65     m_Importer = 0;
66     }
67 }
68
69
70
71 /**
72  * Set an itk::Image as input 
73  */
74 template <class TInputImage>
75 void
76 ImageToVTKImageFilter<TInputImage>
77 ::SetInput( const InputImageType * inputImage )
78 {
79   m_Exporter->SetInput( inputImage );
80 }
81
82
83
84 /**
85  * Get a vtkImage as output
86  */
87 template <class TInputImage>
88 vtkImageData *
89 ImageToVTKImageFilter<TInputImage>
90 ::GetOutput() const
91 {
92   return m_Importer->GetOutput();
93 }
94
95
96
97
98 /**
99  * Get the importer filter
100  */
101 template <class TInputImage>
102 vtkImageImport *
103 ImageToVTKImageFilter<TInputImage>
104 ::GetImporter() const
105 {
106   return m_Importer;
107 }
108
109
110
111 /**
112  * Get the exporter filter
113  */
114 template <class TInputImage>
115 typename ImageToVTKImageFilter<TInputImage>::ExporterFilterType *
116 ImageToVTKImageFilter<TInputImage>
117 ::GetExporter() const
118 {
119   return m_Exporter.GetPointer();
120 }
121
122
123
124 /**
125  * Delegate the Update to the importer
126  */
127 template <class TInputImage>
128 void
129 ImageToVTKImageFilter<TInputImage>
130 ::Update()
131 {
132   m_Importer->Update();
133 }
134
135
136
137
138
139 } // end namespace itk
140
141 #endif
142