I’m trying to build vtk 9 with the python wrapper and including some modules I need (in particular the vtkDICOM), the mesa and building the static libraries.
The aim is to be able to use the vtkGDCMImageReader or the vtkDICOMReader in a project.
Just for information I followed these guides: GDCM/INSTALL.txt at master · malaterre/GDCM · GitHub and https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/dev/build.md. Moreover, I’m building it on a CentOS (so the cmake3 and the python executables in /opt/).
First thing I tried was to compile the gdcm 3.0.10 library including the vtk 9.0.1 build and from there generating the vtkgdcm lib in order to import the vtkGDCMImageReader in python but without any luck since I couldn’t even finish the configure part with cmake.
Then I tried the reverse: compiling the vtk enabling the gdcm (and passing a build configured only with the shared libs on) with the parameters that follows:
cmake3 \ -GNinja \ -D CMAKE_BUILD_TYPE:STRING=Release \ -D BUILD_SHARED_LIBS:BOOL=ON \ -D VTK_ENABLE_REMOTE_MODULES=ON \ -D VTK_ENABLE_WRAPPING:BOOL=ON \ -D VTK_MODULE_ENABLE_VTK_Python:STRING=YES \ -D VTK_MODULE_ENABLE_VTK_vtkDICOM=WANT \ -D VTK_OPENGL_HAS_OSMESA:BOOL=ON \ -D VTK_PYTHON_VERSION:STRING=3 \ -D VTK_RELOCATABLE_INSTALL:BOOL=ON \ -D VTK_USE_X:BOOL=OFF \ -D VTK_WRAP_PYTHON:BOOL=ON \ -D VTK_WHEEL_BUILD:STRING=YES \ -D OSMESA_INCLUDE_DIR:PATH=/opt/mesa/include \ -D OSMESA_LIBRARY:FILEPATH=/opt/mesa/lib/libOSMesa.so \ -D Python3_EXECUTABLE:FILEPATH=/opt/python3/bin/python3.7 \ -D Python3_INCLUDE_DIR:PATH=/opt/python3/include/python3.7m \ -D Python3_LIBRARY:PATH=/opt/python3/lib/libpython3.7m.so \ -D USE_GDCM=ON \ -D GDCM_DIR=/opt/build/gdcm/gdcm-build \ ../vtk
This step worked and also compiling it with ninja produced the wrapper and the wheel I needed.
Testing it, however, gives this error:
Traceback (most recent call last): File "test.py", line 7, in <module> import vtk File "/opt/python3/lib/python3.7/site-packages/vtk.py", line 30, in <module> all_m = importlib.import_module('vtkmodules.all') File "/opt/python3/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/opt/python3/lib/python3.7/site-packages/vtkmodules/all.py", line 14, in <module> from .vtkDICOM import * ImportError: libgdcmMSFF.so.3.0: cannot open shared object file: No such file or directory
Do you have something to suggest? Thanks