Operating system: linux
Slicer version: 4.10.1
Expected behavior: create 3 volumes from a CLI module
Actual behavior: Slicer crashes
We’re trying to create a CLI module that reads from a directory of dicom files and outputs a DWI volume, a scalar volume, and a label map volume for the data set. The module loads and runs without error, but Slicer crashes after the module finishes before displaying any of the volumes.
Initially, we tried this with the CLI taking the directory as input and returning a single scalar volume, which worked as expected.
How can we create three volumes, including display properties for each, and return them from a CLI module?
Our XML definition file looks like:
<?xml version="1.0" encoding="utf-8"?>
Output DWI Volume
Output Scalar Volume
Output Label Map Volume
Most likely one of the volumes is invalid. If I remember correctly, an invalid DWI volume can force Slicer to crash, so I would have a closer look at that first.
Enable “Developer mode” in Slicer application settings to make Slicer keep CLI input and output files (normally they are deleted when CLI execution is completed) and check if you can make Slicer crash by loading them manually (using menu: File / Add data).
Thanks for the reply, I’ve been looking specifically at the DWI volume:
If you open Slicer and run the CLI it runs without error, but displays this line several times before Slicer crashes:
Input port 0 of algorithm vtkImageExtractComponents(0x8fdd970) has 0 connections but is not optional.
If you then restart Slicer and load the DWI volume through ‘Add data’ it loads without error, but if you try to show it in the 3D display it does this (without crashing):
Failed to determine texture parameters. IF=0 F=6407 T=5121
The other nodes (Scalar and Label Map) both load without error and display normally. If you’ve been using Slicer with other modules, and then try to run the CLI it doesn’t crash and displays the Scalar Volume and the Label Map Volume, but when you try to display the DWI Volume it doesn’t update the display.
Our python code creating the DWI reads:
dwi_out = slicer.vtkMRMLNRRDStorageNode()
dwi_node = mrml.vtkMRMLDiffusionWeightedVolumeNode()
slicer.util.updateVolumeFromArray(dwi_node, dwi_array) # dwi_array is created elsewhere and has shape
# Update RAS matrix
ijktoras = vtk.vtkMatrix4x4()
# Update origin and spacing
origin = (cs.pixel_x0_left_cm * -10, cs.pixel_y0_posterior_cm * -10, cs.min_superior_cm * -10)
spacing = (cs.pixel_spacing_cm * 10, cs.pixel_spacing_cm * 10, cs.spacing_between_slices_cm * 10)
The scalar volume and label map are created with identical calls (except the type of volume node). Are we missing something in creating the DWI volume?
DWI volume is much harder to create correctly. I would suggest to compare the file that you create to the DWI volume in SampleData module and make sure they are in the exact same format.