Slicer error in getting segmentation when using monai label

Hi,

I am working with Slicer5.6.2 and MONAILabel on my mac, using port forwarding from a Ubuntu server.
The connection, server log, and client interface seem pretty good, but a slicer error raises everytime I try to get a result. No matter I use the function autoseg or scribble annotation, the last line in details of the error will always be:
"ERROR: Unable to determine ImageIO writer for “slicer:…#vtkMRMLLabelMapVolumeNode…”
The problem persists whether I was running the exemplary app or a custom app.

Server log:

Blockquote

[2024-04-13 13:11:30,113] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:77) - POST - Input Keys: ['device', 'model', 'image', 'result_extension', 'result_dtype', 'client_id', 'description', 'image_path', 'image_meta_dict', 'latencies', 'pred']
[2024-04-13 13:11:30,120] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (EnsureTyped): Time: 0.0008; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: torch.Size([8, 512, 512, 90])(torch.float32)
[2024-04-13 13:11:30,145] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (Activationsd): Time: 0.0228; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: torch.Size([8, 512, 512, 90])(torch.float32)
[2024-04-13 13:11:30,161] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (AsDiscreted): Time: 0.0142; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: torch.Size([1, 512, 512, 90])(torch.float32)
[2024-04-13 13:11:30,165] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (SqueezeDimd): Time: 0.0016; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: torch.Size([512, 512, 90])(torch.float32)
[2024-04-13 13:11:30,594] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (ToNumpyd): Time: 0.4269; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: (512, 512, 90)(float32)
[2024-04-13 13:11:30,596] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (Restored): Time: 0.0007; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: (512, 512, 90)(float32)
[2024-04-13 13:11:57,518] [87952] [MainThread] [INFO] (monailabel.interfaces.utils.transform:122) - POST - Transform (GetCentroidsd): Time: 26.9163; image: torch.Size([9, 128, 128, 128])(torch.float32); pred: (512, 512, 90)(float32)
[2024-04-13 13:11:57,522] [87952] [MainThread] [INFO] (monailabel.tasks.infer.basic_infer:604) - Writing Result...
[2024-04-13 13:11:57,532] [87952] [MainThread] [INFO] (monailabel.transform.writer:196) - Result ext: .nrrd; write_to_file: True; dtype: uint8
[2024-04-13 13:11:59,297] [87952] [MainThread] [INFO] (monailabel.tasks.infer.basic_infer:335) - ++ Latencies => Total: 41.1608; Pre: 11.5325; Inferer: 0.3257; Invert: 0.1006; Post: 27.4148; Write: 1.7746
[2024-04-13 13:11:59,299] [87952] [MainThread] [INFO] (monailabel.tasks.infer.basic_infer:370) - Result File: /tmp/tmp6mf0gp4b.nrrd
[2024-04-13 13:11:59,300] [87952] [MainThread] [INFO] (monailabel.tasks.infer.basic_infer:371) - Result Json Keys: ['label_names', 'latencies', 'centroids']

Slicer error:
When using autoseg —— Failed to run inference in MONAI Label Server.
When using scribble —— Failed to post process label on MONAI Label Sever using Histogram+GraphCut.
Details of the error using autoseg:

Blockquote

Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/Extensions-32448/MONAILabel/lib/Slicer-5.6/qt-scripted-modules/MONAILabel.py", line 1553, in onClickSegmentation
    self.updateSegmentationMask(result_file, labels)
  File "/Applications/Slicer.app/Contents/Extensions-32448/MONAILabel/lib/Slicer-5.6/qt-scripted-modules/MONAILabel.py", line 1755, in updateSegmentationMask
    labelmapVolumeNode = sitkUtils.PushVolumeToSlicer(labelImage, None, className="vtkMRMLLabelMapVolumeNode")
  File "/Applications/Slicer.app/Contents/bin/Python/sitkUtils.py", line 25, in PushVolumeToSlicer
    sitk.WriteImage(sitkimage, myNodeFullITKAddress)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/SimpleITK/extra.py", line 425, in WriteImage
    return writer.Execute(image)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/SimpleITK/SimpleITK.py", line 7907, in Execute
    return _SimpleITK.ImageFileWriter_Execute(self, *args)
RuntimeError: Exception thrown in SimpleITK ImageFileWriter_Execute: /Users/runner/work/1/sitk/Code/IO/src/sitkImageFileWriter.cxx:206:
sitk::ERROR: Unable to determine ImageIO writer for "slicer:0x7fabb9c9c2e0#vtkMRMLLabelMapVolumeNode3"

Is there anyway I can fix the problem? Thanks in advance.

It seems that one of the extensions that you installed replaced SimpleITK package that is bundled with Slicer. To restore SimpleITK, you can reinstall Slicer into a new folder and avoid the extension that replaced SimpleITK.

Thank you for the prompt reply! It worked!

1 Like

Do you know which extension was the culprit?