[Insight-users] Problems building ItkVtkGlue wrapper on ITK 3.20

Miguel Sotaquirá msotaquira at gmail.com
Sun Jan 29 01:43:51 EST 2012


Hi again!

I've just found the solution in case any of you have the same problem. It's
necessary to patch the itkvtk.swg swig source file, located in
Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/
of itk's source directory. In this file just replace the lines:

#ifdef SWIGPYTHON

%{

#include "vtkPythonUtil.h"

%}


with these:

#ifdef SWIGPYTHON

%module ItkVtkGluePython


%{

#include "vtkPythonUtil.h"

#if (VTK_MAJOR_VERSION > 5 ||((VTK_MAJOR_VERSION == 5)&&(VTK_MINOR_VERSION
> 6)))

#define vtkPythonGetObjectFromPointer vtkPythonUtil::GetObjectFromPointer

#define vtkPythonGetPointerFromObject vtkPythonUtil::GetPointerFromObject

#endif

%}


Then build itkvtkglue as an external project and that's it.


Miguel


2012/1/25 Miguel Sotaquirá <msotaquira at gmail.com>

> Hi!
>
> I've just build and installed itk 3.20 with python bindings (didn't manage
> to do it using version 4.0, don't know why)... I've also installed vtk 5.8
> + python. I'm using MAC OS X 10.6.8.
>
> Now I'm trying to build the wrappers for connecting itk with vtk and
> viceversa, from the
> directory.../src-itk-3.20.1/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/.
> During building I get this error:
>
> [ 83%] Building CXX object
> Wrapping/CMakeFiles/_ItkVtkGluePython.dir/wrap_ItkVtkGluePythonPython.o
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_ItkVtkGluePythonPython.cxx:1401:
> warning: ‘void SWIG_exception_(int, const char*)’ defined but not used
> [ 91%] Building CXX object
> Wrapping/CMakeFiles/_ItkVtkGluePython.dir/wrap_itkImageToVTKImageFilterPython.o
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC3_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:1815:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC3_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:1846:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL3_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2034:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL3_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2065:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL3_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2350:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL3_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2371:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL2_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3196:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL2_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3227:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL2_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3512:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUL2_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3533:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS2_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4363:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS2_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4394:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS3_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4587:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS3_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4618:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC3_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4908:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC3_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4929:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF3_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:5759:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF3_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:5790:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF3_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:6080:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF3_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:6101:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS2_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7020:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS2_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7041:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS3_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7968:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUS3_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7989:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF2_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:8819:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF2_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:8850:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF2_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:9140:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIF2_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:9161:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC2_GetImporter(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:9983:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC2_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:10014:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC2_Pointer_GetImporter(PyObject*,
> PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:10304:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:
> In function ‘PyObject*
> _wrap_itkImageToVTKImageFilterIUC2_Pointer_GetOutput(PyObject*, PyObject*)’:
> /Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:10325:
> error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope
> make[2]: ***
> [Wrapping/CMakeFiles/_ItkVtkGluePython.dir/wrap_itkImageToVTKImageFilterPython.o]
> Error 1
> make[1]: *** [Wrapping/CMakeFiles/_ItkVtkGluePython.dir/all] Error 2
> make: *** [all] Error 2
>
> After checking I found that ‘vtkPythonGetObjectFromPointer’ is declared in
> 'vtkPythonUtil.h', which is a header already installed in my vtk 5.8
> version. This header should be included in the file
> 'wrap_itkImageToVTKImageFilterPython.cxx', automatically generated during
> the building process... However, when this file is created, for some reason
> 'vtkPythonUtil.h' has not been included.
>
> Does any of you can give me some clues? Do I have to modify something in
> any of the CMakeLists.txt files of the ItkVtkGlue directory? Do I need to
> rebuild ITK+Python? (I hope not, since it take a loooooong!)
>
> Thanks for any advice,
> Miguel Sotaquira
> PhD Student
> Bioengineering Department
> Politecnico di Milano
> Milan (IT)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120129/b922e87b/attachment.htm>


More information about the Insight-users mailing list