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 *=========================================================================*/
19 #ifndef itkVTKImageToImageFilter_h
20 #define itkVTKImageToImageFilter_h
22 #include "itkVTKImageImport.h"
23 #include "vtkImageExport.h"
24 #include "vtkImageData.h"
25 #include "vtkSmartPointer.h"
27 #ifndef vtkFloatingPointType
28 #define vtkFloatingPointType float
34 /** \class VTKImageToImageFilter
35 * \brief Converts a VTK image into an ITK image and plugs a
36 * VTK data pipeline to an ITK datapipeline.
38 * This class puts together an itk::VTKImageImport and a vtk::ImageExport.
39 * It takes care of the details related to the connection of ITK and VTK
40 * pipelines. The User will perceive this filter as an adaptor to which
41 * a vtkImageData can be plugged as input and an itk::Image is produced as
46 template <typename TOutputImage >
47 class VTKImageToImageFilter : public VTKImageImport< TOutputImage >
50 /** Standard class typedefs. */
51 typedef VTKImageToImageFilter Self;
52 typedef VTKImageImport< TOutputImage > Superclass;
53 typedef SmartPointer<Self> Pointer;
54 typedef SmartPointer<const Self> ConstPointer;
56 /** Method for creation through the object factory. */
59 /** Run-time type information (and related methods). */
60 itkTypeMacro(VTKImageToImageFilter, VTKImageImport);
63 typedef TOutputImage OutputImageType;
64 typedef typename OutputImageType::ConstPointer OutputImagePointer;
66 /** Set the input in the form of a vtkImageData */
67 void SetInput( vtkImageData * );
68 using Superclass::SetInput;
70 /** Return the internal VTK image exporter filter.
71 This is intended to facilitate users the access
72 to methods in the exporter */
73 vtkImageExport * GetExporter() const;
75 /** Return the internal ITK image importer filter.
76 This is intended to facilitate users the access
77 to methods in the importer.
79 const Superclass * GetImporter() const;
82 VTKImageToImageFilter();
83 virtual ~VTKImageToImageFilter();
86 VTKImageToImageFilter(const Self&) ITK_DELETE_FUNCTION;
87 void operator=(const Self&) ITK_DELETE_FUNCTION;
89 typedef vtkSmartPointer<vtkImageExport> ImageExportPointer;
90 ImageExportPointer m_Exporter;
94 } // end namespace itk
96 #ifndef ITK_MANUAL_INSTANTIATION
97 #include "itkVTKImageToImageFilter.hxx"