1 /*=========================================================================
3 * Copyright Insight Software Consortium
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *=========================================================================*/
18 #ifndef __itkImageToVTKImageFilter_h
19 #define __itkImageToVTKImageFilter_h
21 #include "itkVTKImageExport.h"
22 #include "vtkImageImport.h"
23 #include "vtkImageData.h"
28 /** \class ImageToVTKImageFilter
29 * \brief Converts an ITK image into a VTK image and plugs a
30 * itk data pipeline to a VTK datapipeline.
32 * This class puts together an itkVTKImageExporter and a vtkImageImporter.
33 * It takes care of the details related to the connection of ITK and VTK
34 * pipelines. The User will perceive this filter as an adaptor to which
35 * an itk::Image can be plugged as input and a vtkImage is produced as
41 * \wikiexample{IO/ImageToVTKImageFilter,Display an ITK image}
42 * \wikiexample{IO/itkVtkImageConvertDICOM,Uses a custom user matrix to align the image with DICOM physical space}
45 template <typename TInputImage >
46 class ImageToVTKImageFilter : public ProcessObject
49 /** Standard class typedefs. */
50 typedef ImageToVTKImageFilter Self;
51 typedef ProcessObject Superclass;
52 typedef SmartPointer<Self> Pointer;
53 typedef SmartPointer<const Self> ConstPointer;
55 /** Method for creation through the object factory. */
58 /** Run-time type information (and related methods). */
59 itkTypeMacro(ImageToVTKImageFilter, ProcessObject);
62 typedef TInputImage InputImageType;
63 typedef typename InputImageType::ConstPointer InputImagePointer;
65 typedef VTKImageExport< InputImageType> ExporterFilterType;
66 typedef typename ExporterFilterType::Pointer ExporterFilterPointer;
68 /** Get the output in the form of a vtkImage.
69 This call is delegated to the internal vtkImageImporter filter */
70 vtkImageData * GetOutput() const;
72 /** Set the input in the form of an itk::Image */
73 using Superclass::SetInput;
74 void SetInput( const InputImageType * );
75 InputImageType * GetInput();
77 /** Return the internal VTK image importer filter.
78 This is intended to facilitate users the access
79 to methods in the importer */
80 vtkImageImport * GetImporter() const;
82 /** Return the internal ITK image exporter filter.
83 This is intended to facilitate users the access
84 to methods in the exporter */
85 ExporterFilterType * GetExporter() const;
87 /** This call delegates the update to the importer */
91 ImageToVTKImageFilter();
92 virtual ~ImageToVTKImageFilter();
95 ImageToVTKImageFilter(const Self&); //purposely not implemented
96 void operator=(const Self&); //purposely not implemented
98 ExporterFilterPointer m_Exporter;
99 vtkImageImport * m_Importer;
102 } // end namespace itk
104 #ifndef ITK_MANUAL_INSTANTIATION
105 #include "itkImageToVTKImageFilter.hxx"