1 #ifndef __ITKToVTKImageImport_h_
2 #define __ITKToVTKImageImport_h_
5 #include "itkVTKImageImport.h"
6 #include "itkVTKImageExport.h"
7 #include <itkProcessObject.h>
9 #include "vtkImageData.h"
10 #include "vtkImageImport.h"
11 #include "vtkImageExport.h"
14 #define TRY_CLAUSE_ITK try{
15 #define CATCH_CLAUSE_ITK }catch(itk::ExceptionObject &e){ \
16 std::cout<<e<<std::endl; \
17 std::string ex = e.GetDescription();}\
21 //------------------------------------------------------------------------------------------------------------
23 //------------------------------------------------------------------------------------------------------------
24 template<typename TypeImage>
25 class ITK_EXPORT ITKToVTKImageImport :
31 /** Standard class typedefs. */
32 typedef ITKToVTKImageImport Self;
34 /** Standard "Superclass" typedef */
35 typedef ProcessObject Superclass;
37 /** Smart pointer typedef support. */
38 typedef SmartPointer<Self> Pointer;
39 typedef SmartPointer<const Self> ConstPointer;
41 /** Method for creation through the object factory. */
44 /** Run-time type information (and related methods). */
45 itkTypeMacro( ITKToVTKImageImport, ProcessObject );
47 /** InputImageType typedef support. */
48 typedef TypeImage InputImageType;
49 typedef typename InputImageType::Pointer InputImagePointerType;
50 typedef typename InputImageType::PixelType PixelType;
51 typedef typename InputImageType::IndexType IndexType;
54 * type definition for the itk image import
56 typedef itk::VTKImageImport<InputImageType> ImageImportType;
58 typedef typename ImageImportType::Pointer ImageImportPointer;
60 * type definition for the itk image import
62 typedef itk::VTKImageExport<InputImageType> ImageExportType;
64 * type definition for the pointer of the image import
66 typedef typename ImageExportType::Pointer ImageExportPointer;
69 * set the vtkImage data to connect to itk pipeline
71 void SetVTKImage(vtkImageData* img);
74 * Get the vtkImageData from the itk image
76 vtkImageData* GetOutputVTKImage();
79 void SetITKImage(InputImagePointerType itkimage);
83 InputImagePointerType GetOutputITKImage() ;
85 //------------------------------------------------------------------------------------------------------------
87 //------------------------------------------------------------------------------------------------------------
90 ** Default constructor, allocates the vtkImageExport and itkImageImport
91 ** Connects the pipelines and set them ready to be use
93 ITKToVTKImageImport();
94 ~ITKToVTKImageImport();
100 vtkImageData* m_VTKImage;
102 InputImagePointerType m_ITKImage;
105 * Pointer to vtkImageExport
107 vtkImageExport * vtkimageexport;
109 * itk::VTKImageImport pointer
111 ImageImportPointer imageimportpointer;
113 * Pointer to vtkImageExport
115 vtkImageImport * vtkimageimport;
117 * Pointer to Export the itk image into vtk
119 ImageExportPointer imageexportpointer;
124 #ifndef ITK_MANUAL_INSTANTIATION
125 #include "itktovtkimageimport.txx"