2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Program: Insight Segmentation & Registration Toolkit
31 Module: $RCSfile: itkImageToVTKImageFilter.txx,v $
33 Date: $Date: 2012/11/16 08:50:49 $
34 Version: $Revision: 1.2 $
37 =========================================================================*/
38 #ifndef _itkImageToVTKImageFilter_txx
39 #define _itkImageToVTKImageFilter_txx
41 #include "itkImageToVTKImageFilter.h"
51 template <class TInputImage>
52 ImageToVTKImageFilter<TInputImage>
53 ::ImageToVTKImageFilter()
56 m_Importer = vtkImageImport::New();
58 m_Exporter = ExporterFilterType::New();
60 m_Importer->SetUpdateInformationCallback(m_Exporter->GetUpdateInformationCallback());
61 m_Importer->SetPipelineModifiedCallback(m_Exporter->GetPipelineModifiedCallback());
62 m_Importer->SetWholeExtentCallback(m_Exporter->GetWholeExtentCallback());
63 m_Importer->SetSpacingCallback(m_Exporter->GetSpacingCallback());
64 m_Importer->SetOriginCallback(m_Exporter->GetOriginCallback());
65 m_Importer->SetScalarTypeCallback(m_Exporter->GetScalarTypeCallback());
66 m_Importer->SetNumberOfComponentsCallback(m_Exporter->GetNumberOfComponentsCallback());
67 m_Importer->SetPropagateUpdateExtentCallback(m_Exporter->GetPropagateUpdateExtentCallback());
68 m_Importer->SetUpdateDataCallback(m_Exporter->GetUpdateDataCallback());
69 m_Importer->SetDataExtentCallback(m_Exporter->GetDataExtentCallback());
70 m_Importer->SetBufferPointerCallback(m_Exporter->GetBufferPointerCallback());
71 m_Importer->SetCallbackUserData(m_Exporter->GetCallbackUserData());
81 template <class TInputImage>
82 ImageToVTKImageFilter<TInputImage>
83 ::~ImageToVTKImageFilter()
95 * Set an itk::Image as input
97 template <class TInputImage>
99 ImageToVTKImageFilter<TInputImage>
100 ::SetInput( const InputImageType * inputImage )
102 m_Exporter->SetInput( inputImage );
108 * Get a vtkImage as output
110 template <class TInputImage>
112 ImageToVTKImageFilter<TInputImage>
115 return m_Importer->GetOutput();
122 * Get the importer filter
124 template <class TInputImage>
126 ImageToVTKImageFilter<TInputImage>
127 ::GetImporter() const
135 * Get the exporter filter
137 template <class TInputImage>
138 typename ImageToVTKImageFilter<TInputImage>::ExporterFilterType *
139 ImageToVTKImageFilter<TInputImage>
140 ::GetExporter() const
142 return m_Exporter.GetPointer();
148 * Delegate the Update to the importer
150 template <class TInputImage>
152 ImageToVTKImageFilter<TInputImage>
155 m_Importer->Update();
162 } // end namespace itk