| 1 |
/* This file declares various VTK datatype to SWIG so they can be refered as*/ |
| 2 |
/* something else than SwigObject*/ |
| 3 |
/* Python bindings have been tested successfully.*/ |
| 4 |
/* TODO: Test TCL bindings*/ |
| 5 |
|
| 6 |
%include exception.i |
| 7 |
|
| 8 |
%{ |
| 9 |
// VTK also includes a Py_hash_t type definition for Python 2 that clashes |
| 10 |
// with SWIG's preprocessor macro |
| 11 |
#if PY_VERSION_HEX < 0x3020000 |
| 12 |
#ifdef Py_hash_t |
| 13 |
#undef Py_hash_t |
| 14 |
#endif |
| 15 |
#endif |
| 16 |
|
| 17 |
#include "vtkImageImport.h" |
| 18 |
#include "vtkImageExport.h" |
| 19 |
#include "itkImageToImageFilter.h" |
| 20 |
#include "itkVTKImageExport.h" |
| 21 |
#include "itkVTKImageImport.h" |
| 22 |
#include "vtkImageData.h" |
| 23 |
|
| 24 |
%} |
| 25 |
|
| 26 |
#ifdef SWIGTCL |
| 27 |
%{ |
| 28 |
#include "vtkTclUtil.h" |
| 29 |
%} |
| 30 |
|
| 31 |
%typemap(in) vtkImageExport* { |
| 32 |
int cerror=0; |
| 33 |
$1 = NULL; |
| 34 |
$1 = (vtkImageExport*) vtkTclGetPointerFromObject(Tcl_GetString($input), |
| 35 |
"vtkImageExport", interp, |
| 36 |
cerror ); |
| 37 |
if ( cerror ) { SWIG_fail; } |
| 38 |
} |
| 39 |
|
| 40 |
%typemap(in) vtkImageImport* { |
| 41 |
int cerror=0; |
| 42 |
$1 = NULL; |
| 43 |
$1 = (vtkImageImport*) vtkTclGetPointerFromObject(Tcl_GetString($input), |
| 44 |
"vtkImageImport", interp, |
| 45 |
cerror ); |
| 46 |
if ( cerror ) { SWIG_fail; } |
| 47 |
} |
| 48 |
#endif |
| 49 |
|
| 50 |
#ifdef SWIGPYTHON |
| 51 |
%module(package="itk",threads="1") VtkGluePython |
| 52 |
|
| 53 |
%{ |
| 54 |
#include "vtkPythonUtil.h" |
| 55 |
#include "vtkVersion.h" |
| 56 |
#if (VTK_MAJOR_VERSION > 5 ||((VTK_MAJOR_VERSION == 5)&&(VTK_MINOR_VERSION > 6))) |
| 57 |
#define vtkPythonGetObjectFromPointer vtkPythonUtil::GetObjectFromPointer |
| 58 |
#define vtkPythonGetPointerFromObject vtkPythonUtil::GetPointerFromObject |
| 59 |
#endif |
| 60 |
%} |
| 61 |
|
| 62 |
%typemap(out) vtkImageExport* { |
| 63 |
PyImport_ImportModule("vtk"); |
| 64 |
$result = vtkPythonGetObjectFromPointer ( (vtkImageExport*)$1 ); |
| 65 |
} |
| 66 |
|
| 67 |
%typemap(out) vtkImageImport* { |
| 68 |
PyImport_ImportModule("vtk"); |
| 69 |
$result = vtkPythonGetObjectFromPointer ( (vtkImageImport*)$1 ); |
| 70 |
} |
| 71 |
|
| 72 |
%typemap(out) vtkImageData* { |
| 73 |
PyImport_ImportModule("vtk"); |
| 74 |
$result = vtkPythonGetObjectFromPointer ( (vtkImageData*)$1 ); |
| 75 |
} |
| 76 |
|
| 77 |
%typemap(in) vtkImageData* { |
| 78 |
$1 = NULL; |
| 79 |
$1 = (vtkImageData*) vtkPythonGetPointerFromObject ( $input, "vtkImageData" ); |
| 80 |
if ( $1 == NULL ) { SWIG_fail; } |
| 81 |
} |
| 82 |
|
| 83 |
%typemap(out) vtkPolyData* { |
| 84 |
PyImport_ImportModule("vtk"); |
| 85 |
$result = vtkPythonGetObjectFromPointer ( (vtkPolyData*)$1 ); |
| 86 |
} |
| 87 |
|
| 88 |
%typemap(in) vtkPolyData* { |
| 89 |
$1 = NULL; |
| 90 |
$1 = (vtkPolyData*) vtkPythonGetPointerFromObject ( $input, "vtkPolyData" ); |
| 91 |
if ( $1 == NULL ) { SWIG_fail; } |
| 92 |
} |
| 93 |
#endif |
| 94 |
|
| 95 |
#ifdef SWIGJAVA |
| 96 |
%{ |
| 97 |
#include "vtkJavaUtil.h" |
| 98 |
%} |
| 99 |
|
| 100 |
/*// TODO: The java typemaps seem to only work in java.i, they are harmless in that file but misplaces.*/ |
| 101 |
#endif |