[Insight-users] Connecting itk image to vtk with Module_ITKVtkGlue

Mathieu Stumpf mathieu.stumpf at etu.unistra.fr
Fri Mar 2 08:49:56 EST 2012


Hello,

I want to make communicate itk with itk in python.

I recompiled itk (from git) with the Module_ITKVtkGlue.

The installation seems ok[1], but I can't launch any working example. I
tried the CannyEdgeDetectionImageFilterConnectVTKITK.py found in
Examples/Visualization but got this error :

        python CannyEdgeDetectionImageFilterConnectVTKITK.py 
        Traceback (most recent call last):
          File "CannyEdgeDetectionImageFilterConnectVTKITK.py", line 33,
        in <module>
            import InsightToolkit as itk
          File "/usr/local/lib/ITK-4.1/Python/InsightToolkit.py", line
        75, in <module>
            from ITKMetricsv4Python import *
        ImportError: No module named ITKMetricsv4Python
        
Note that the code say "For this to work, you have to build
InsightApplications/ConnectVTKITK". To install it (git version) I had to
change the CMakelists.txt because the conditions around
OPTIONAL_APP(ConnectVTKITK) seems no to be fulfilled.

Putting OPTIONAL_APP(ConnectVTKITK) as is and setting my env as bellow
compiled without error (but with a warning about CMAKE_MODULE_PATH while
configuring with ccmake) :
        export CableSwig_DIR=/usr/local/WrapITK/lib/CableSwig/:${CableSwig_DIR}
        export CMAKE_MODULE_PATH=${CableSwig_DIR}:${CMAKE_MODULE_PATH}
        
But I have still the same error when I try to launch
CannyEdgeDetectionImageFilterConnectVTKITK.py

It seems that after all this installations the ITKMetrics wrapper wasn't
generated[2]. Is there any optional module that I missed ?
        

I also tried to write a little script (see attached file) to open an
image with itk and display it with vtk, but I got the following errors :

        Traceback (most recent call last):
          File "/home/miv/stumpf/src/farsight-tuto/quick-start/basic_reader.py", line 24, in <module>
            export.SetInput(itk_image) # !!! bug !!!
        TypeError: in method 'itkVTKImageExportIUC2_SetInput', argument 2 of type 'itkImageUC2 const *'
        swig/python detected a memory leak of type 'itkDataObject_Pointer *', no destructor found.
        
Let me now if you are aware of a simple python module which just open a
nifti picture with itk and display it through vtk.

Kind regards,
Mathieu



[1]
        $ find /usr/local/ -iname *itkVTK*|grep 4.1
        /usr/local/include/ITK-4.1/itkVTKImageExportBase.h
        /usr/local/include/ITK-4.1/itkVTKPolyDataMeshIO.h
        /usr/local/include/ITK-4.1/itkVTKImageExport.h
        /usr/local/include/ITK-4.1/itkVTKImageImport.hxx
        /usr/local/include/ITK-4.1/itkVTKPolyDataMeshIOFactory.h
        /usr/local/include/ITK-4.1/itkVTKPolyDataReader.h
        /usr/local/include/ITK-4.1/itkVTKImageIO.h
        /usr/local/include/ITK-4.1/itkVTKImageToImageFilter.h
        /usr/local/include/ITK-4.1/itkVTKPolyDataWriter.h
        /usr/local/include/ITK-4.1/itkVTKImageImport.h
        /usr/local/include/ITK-4.1/itkVTKImageIOFactory.h
        /usr/local/include/ITK-4.1/itkVTKPolyDataWriter.hxx
        /usr/local/include/ITK-4.1/itkVTKImageToImageFilter.hxx
        /usr/local/include/ITK-4.1/itkVTKPolyDataReader.hxx
        /usr/local/include/ITK-4.1/itkVTKImageExport.hxx
        /usr/local/lib/libITKVtkGlue-4.1.so
        /usr/local/lib/libITKVTK-4.1.so
        /usr/local/lib/libITKVTK-4.1.so.1
        /usr/local/lib/cmake/ITK-4.1/Modules/ITKVtkGlue.cmake
        /usr/local/lib/cmake/ITK-4.1/Modules/ITKVTK.cmake
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageImportSwigInterface.h.in
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/ITKVtkGlue.mdx
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/ITKVTK.mdx
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageIO.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageImport.idx
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageExport.idx
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageImport.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageToImageFilter.idx
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageExportSwigInterface.h.in
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageToImageFilterSwigInterface.h.in
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/ITKVtkGlue.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageExport.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageIO.idx
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/ITKVTK.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageIOSwigInterface.h.in
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/itkVTKImageToImageFilter.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/python/itkVTKImageIO_ext.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/python/ITKVTK_ext.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/python/itkVTKImageImport_ext.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/python/itkVTKImageToImageFilter_ext.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/python/itkVTKImageExport_ext.i
        /usr/local/lib/cmake/ITK-4.1/WrapITK/Configuration/Typedefs/python/ITKVtkGlue_ext.i
        /usr/local/lib/ITK-4.1/Python/itkVTKImageToImageFilterPython.py
        /usr/local/lib/ITK-4.1/Python/itkVTKImageIOPython.py
        /usr/local/lib/ITK-4.1/Python/ITKVtkGlue.py
        /usr/local/lib/ITK-4.1/Python/itkVTKImageExportPython.py
        /usr/local/lib/ITK-4.1/Python/_ITKVTKPython.so
        /usr/local/lib/ITK-4.1/Python/ITKVTK.py
        /usr/local/lib/ITK-4.1/Python/_ITKVtkGluePython.so
        /usr/local/lib/ITK-4.1/Python/ITKVTKPython.py
        /usr/local/lib/ITK-4.1/Python/itkVTKImageImportPython.py
        /usr/local/lib/ITK-4.1/Python/ITKVtkGluePython.py
        /usr/local/lib/ITK-4.1/Python/Configuration/ITKVtkGlueConfig.py
        /usr/local/lib/ITK-4.1/Python/Configuration/ITKVTKConfig.py
        /usr/local/lib/libITKVTK-4.1.a
        /usr/local/lib/libITKVtkGlue-4.1.so.1
        
        [2] 
        $ locate ITKMetricsv4
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4.cmake
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/DependInfo.cmake
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/build.make
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/cmake_clean.cmake
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/depend.internal
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/depend.make
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/progress.make
        /home/miv/stumpf/src/itk-git/build/Modules/Registration/Metricsv4/test/ITKMetricsv4TestDriver.cxx
        /home/miv/stumpf/src/itk-git/build/Utilities/Doxygen/Modules/ITKMetricsv4.dox
        /home/miv/stumpf/src/itk-git/build/Utilities/Doxygen/html/ITKMetricsv4_8dox.html
        /home/miv/stumpf/src/itk-git/build/Utilities/Doxygen/html/group__ITKMetricsv4.html
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4/CMakeFiles
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4/CTestTestfile.cmake
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4/Makefile
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4/cmake_install.cmake
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4/CMakeFiles/CMakeDirectoryInformation.cmake
        /home/miv/stumpf/src/itk-git/build/Wrapping/Modules/ITKMetricsv4/CMakeFiles/progress.marks
        /home/miv/stumpf/src/itk-git/build/lib/cmake/ITK-4.1/Modules/ITKMetricsv4.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTestClean.dir
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/DependInfo.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/build.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/cmake_clean.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/depend.internal
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/depend.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4-all.dir/progress.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/DependInfo.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/build.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/cmake_clean.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/depend.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/flags.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/link.txt
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/progress.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTest1.dir/test
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTestClean.dir/DependInfo.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTestClean.dir/build.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTestClean.dir/cmake_clean.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/CMakeFiles/ITKMetricsv4HeaderTestClean.dir/progress.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/ITKMetricsv4TestDriver.cxx
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/DependInfo.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/Labels.txt
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/build.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/cmake_clean.cmake
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/depend.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/flags.make
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/link.txt
        /home/miv/stumpf/src/itk-stable/build/Modules/Registration/Metricsv4/test/CMakeFiles/ITKMetricsv4TestDriver.dir/progress.make
        /home/miv/stumpf/src/itk-stable/build/Utilities/Doxygen/Modules/ITKMetricsv4.dox
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4/CMakeFiles
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4/CTestTestfile.cmake
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4/Makefile
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4/cmake_install.cmake
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4/CMakeFiles/CMakeDirectoryInformation.cmake
        /home/miv/stumpf/src/itk-stable/build/Wrapping/Modules/ITKMetricsv4/CMakeFiles/progress.marks
        /home/miv/stumpf/src/itk-stable/build/lib/cmake/ITK-4.0/Modules/ITKMetricsv4.cmake
        /usr/local/lib/cmake/ITK-4.0/Modules/ITKMetricsv4.cmake
        /usr/local/lib/cmake/ITK-4.1/Modules/ITKMetricsv4.cmake
        
-------------- next part --------------
A non-text attachment was scrubbed...
Name: basic_reader.py
Type: text/x-python
Size: 1131 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120302/77976aab/attachment.py>


More information about the Insight-users mailing list