Shapeworks Studio  2.1
Shape analysis software suite
itkVTKImageToImageFilter.hxx
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: itkVTKImageToImageFilter.txx
5  Language: C++
6  Date: $Date$
7  Version: $Revision$
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 _itkVTKImageToImageFilter_txx
18 #define _itkVTKImageToImageFilter_txx
19 
20 #include "itkVTKImageToImageFilter.h"
21 
22 namespace itk
23 {
24 
25 
26 
30 template <class TOutputImage>
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 
60 template <class TOutputImage>
63 {
64  if( m_Exporter )
65  {
66  m_Exporter->Delete();
67  m_Exporter = 0;
68  }
69 }
70 
71 
72 
76 template <class TOutputImage>
77 void
79 ::SetInput( vtkImageData * inputImage )
80 {
81 #if (VTK_MAJOR_VERSION < 6)
82  m_Exporter->SetInput( inputImage );
83 #else
84  m_Exporter->SetInputData( inputImage );
85 #endif
86 }
87 
88 
89 
93 template <class TOutputImage>
96 ::GetOutput() const
97 {
98  return m_Importer->GetOutput();
99 }
100 
101 
102 
103 
107 template <class TOutputImage>
108 vtkImageExport *
111 {
112  return m_Exporter;
113 }
114 
115 
116 
120 template <class TOutputImage>
121 typename VTKImageToImageFilter<TOutputImage>::ImporterFilterType *
124 {
125  return m_Importer;
126 }
127 
128 
129 
130 
134 template <class TOutputImage>
135 void
138 {
139  m_Importer->Update();
140 }
141 
142 
143 
144 
145 } // end namespace itk
146 
147 #endif
148 
const OutputImageType * GetOutput() const
vtkImageExport * GetExporter() const
ImporterFilterType * GetImporter() const