I would like to install “itk-vtkglue” to convert a vtk image to an itk image. My ultimate goal would be to use the MultiScaleHessianBasedMeasureImageFilter class to detect plate-like shapes inside my python scripted module (this class is not present in SimpleITK).
However after installing the package from the Python Interactor with the command
slicer.util.pip_install("itk-vtkglue")
it is no longer possible to restart slicer and the following error is reported from the terminal:
error: [/home/user/Slicer-4.11.20210226-linux-amd64/bin/SlicerApp-real] exit abnormally - Report the problem
How can I install the software correctly?
Is there any way to use itk directly from a scripted module or do I need to use a CLI module as described in this post?
I would expect itk-vtkglue to be very fragile if it uses C++ interface (it can only be compatible with a specific combination of ITK and VTK versions). If it uses Python interface then you actually not need itk-vtkglue at all, because you can easily convert both ITK and VTK images to/from numpy arrays yourself. You just need to take care of passing the metadata (origin, spacing, and axis directions), because only ITK can store it in the numpy array, VTK does not support this yet.
I would like itk-vtkGlue to work I have an itk filter I want to use on a Slicer’s volume.
After doing volume.GetImageData() I don’t know how to do the convertion to itk image.
I searched for a example doing the numpy interfaced convertion but I couldn’t find any.
Could you help?
The safest way to use ITK filters on VTK image data is to use filters in vtkITK library. If a filter is missing you can add it there.
If you want to work in Python then you may use SimpleITK and pass images to/from Slicer using sitkUtils. For other data types and other Python ITK wrappings (such as ITKPython) you probably need to exchange data via files (Slicer writes to file, ITK reads it, processes it, writes to file, Slicer reads from file).