]> Creatis software - clitk.git/blob - itk/itkVTKImageToImageFilter.txx
Set Directions to CropImage Like
[clitk.git] / itk / itkVTKImageToImageFilter.txx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef _itkVTKImageToImageFilter_txx
19 #define _itkVTKImageToImageFilter_txx
20 #include "itkVTKImageToImageFilter.h"
21
22 namespace itk
23 {
24
25
26
27 /**
28  * Constructor
29  */
30 template <class TOutputImage>
31 VTKImageToImageFilter<TOutputImage>
32 ::VTKImageToImageFilter()
33 {
34
35   m_Exporter = vtkImageExport::New();
36
37   m_Importer = ImporterFilterType::New();
38
39   m_Importer->SetUpdateInformationCallback( m_Exporter->GetUpdateInformationCallback());
40   m_Importer->SetPipelineModifiedCallback( m_Exporter->GetPipelineModifiedCallback());
41   m_Importer->SetWholeExtentCallback( m_Exporter->GetWholeExtentCallback());
42   m_Importer->SetSpacingCallback( m_Exporter->GetSpacingCallback());
43   m_Importer->SetOriginCallback( m_Exporter->GetOriginCallback());
44   m_Importer->SetScalarTypeCallback( m_Exporter->GetScalarTypeCallback());
45   m_Importer->SetNumberOfComponentsCallback( m_Exporter->GetNumberOfComponentsCallback());
46   m_Importer->SetPropagateUpdateExtentCallback( m_Exporter->GetPropagateUpdateExtentCallback());
47   m_Importer->SetUpdateDataCallback( m_Exporter->GetUpdateDataCallback());
48   m_Importer->SetDataExtentCallback( m_Exporter->GetDataExtentCallback());
49   m_Importer->SetBufferPointerCallback( m_Exporter->GetBufferPointerCallback());
50   m_Importer->SetCallbackUserData( m_Exporter->GetCallbackUserData());
51
52 }
53
54
55
56
57 /**
58  * Destructor
59  */
60 template <class TOutputImage>
61 VTKImageToImageFilter<TOutputImage>
62 ::~VTKImageToImageFilter()
63 {
64   if ( m_Exporter ) {
65     m_Exporter->Delete();
66     m_Exporter = 0;
67   }
68 }
69
70
71
72 /**
73  * Set a vtkImageData as input
74  */
75 template <class TOutputImage>
76 void
77 VTKImageToImageFilter<TOutputImage>
78 ::SetInput( vtkImageData * inputImage )
79 {
80 #if VTK_MAJOR_VERSION <= 5
81   m_Exporter->SetInput( inputImage );
82 #else
83   m_Exporter->SetInputData( inputImage );
84 #endif
85 }
86
87
88
89 /**
90  * Get an itk::Image as output
91  */
92 template <class TOutputImage>
93 //const 
94 typename VTKImageToImageFilter<TOutputImage>::OutputImageType *
95 VTKImageToImageFilter<TOutputImage>
96 ::GetOutput() const
97 {
98   return m_Importer->GetOutput();
99 }
100
101
102
103
104 /**
105  * Get the exporter filter
106  */
107 template <class TOutputImage>
108 vtkImageExport *
109 VTKImageToImageFilter<TOutputImage>
110 ::GetExporter() const
111 {
112   return m_Exporter;
113 }
114
115
116
117 /**
118  * Get the importer filter
119  */
120 template <class TOutputImage>
121 typename VTKImageToImageFilter<TOutputImage>::ImporterFilterType *
122 VTKImageToImageFilter<TOutputImage>
123 ::GetImporter() const
124 {
125   return m_Importer;
126 }
127
128
129
130
131 /**
132  * Delegate the Update to the importer
133  */
134 template <class TOutputImage>
135 void
136 VTKImageToImageFilter<TOutputImage>
137 ::Update()
138 {
139   m_Importer->Update();
140 }
141
142
143
144
145 } // end namespace itk
146
147 #endif
148