Hi again!<div><br></div><div>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 <span class="Apple-style-span" style="font-family:Helvetica;font-size:12px">Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/ of itk's source directory. In this file just replace the lines:</span></div>
<div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size:12px"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica"><span class="Apple-style-span" style="font-size:12px"><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">
#ifdef SWIGPYTHON</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">%{</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#include "vtkPythonUtil.h"</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">%}</p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica"><br></p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">with these:</p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">
</p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#ifdef SWIGPYTHON</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">%module ItkVtkGluePython</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica;min-height:14.0px"><br></p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">%{</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#include "vtkPythonUtil.h"</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#if (VTK_MAJOR_VERSION > 5 ||((VTK_MAJOR_VERSION == 5)&&(VTK_MINOR_VERSION > 6)))</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#define vtkPythonGetObjectFromPointer vtkPythonUtil::GetObjectFromPointer</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#define vtkPythonGetPointerFromObject vtkPythonUtil::GetPointerFromObject</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">#endif</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">%}</p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica"><br></p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">Then build itkvtkglue as an external project and that's it.</p>
<p style="margin:0px 0px 0px 0px;font:12.0px Helvetica"><br></p><p style="margin:0px 0px 0px 0px;font:12.0px Helvetica">Miguel</p><p></p></span></font><br><div class="gmail_quote">2012/1/25 Miguel Sotaquirá <span dir="ltr"><<a href="mailto:msotaquira@gmail.com">msotaquira@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<div><br></div><div>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.</div>
<div><br></div><div>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:</div>
<div><br></div><div><div><font size="1">[ 83%] Building CXX object Wrapping/CMakeFiles/_ItkVtkGluePython.dir/wrap_ItkVtkGluePythonPython.o</font></div><div><font size="1">/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</font></div>
<div><font size="1">[ 91%] Building CXX object Wrapping/CMakeFiles/_ItkVtkGluePython.dir/wrap_itkImageToVTKImageFilterPython.o</font></div><div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC3_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:1815: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC3_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:1846: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL3_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2034: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL3_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2065: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL3_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2350: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL3_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:2371: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL2_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3196: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL2_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3227: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL2_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3512: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUL2_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:3533: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS2_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4363: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS2_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4394: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS3_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4587: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS3_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4618: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC3_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4908: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC3_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:4929: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF3_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:5759: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF3_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:5790: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF3_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:6080: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF3_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:6101: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS2_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7020: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS2_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7041: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS3_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7968: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUS3_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:7989: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF2_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:8819: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF2_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:8850: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF2_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:9140: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIF2_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:9161: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC2_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:9983: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC2_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:10014: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC2_Pointer_GetImporter(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:10304: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx: In function ‘PyObject* _wrap_itkImageToVTKImageFilterIUC2_Pointer_GetOutput(PyObject*, PyObject*)’:</font></div>
<div><font size="1">/Users/miguel/code/2Archive/bin-itkvtkglue-3.20.1/Wrapping/wrap_itkImageToVTKImageFilterPython.cxx:10325: error: ‘vtkPythonGetObjectFromPointer’ was not declared in this scope</font></div>
<div><font size="1">make[2]: *** [Wrapping/CMakeFiles/_ItkVtkGluePython.dir/wrap_itkImageToVTKImageFilterPython.o] Error 1</font></div><div><font size="1">make[1]: *** [Wrapping/CMakeFiles/_ItkVtkGluePython.dir/all] Error 2</font></div>
<div><font size="1">make: *** [all] Error 2</font></div></div><div><font size="1"><br></font></div><div>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.</div>
<div><br></div><div>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!)</div>
<div><br></div><div>Thanks for any advice,</div><div>Miguel Sotaquira</div><div>PhD Student</div><div>Bioengineering Department</div><div>Politecnico di Milano</div><div>Milan (IT)</div>
</blockquote></div><br></div>