CreateLabelVolumeFromVolume fails on Linux but not on Windows 10

I am currently running this function in my code in my Python script:

slicer.vtkSlicerVolumesLogic().CreateLabelVolumeFromVolume(slicer.mrmlScene, labelVolumeNode, loadedScalarNode)

On Windows 10 it properly works, and my code later uses the label volume to convert an NRRD into an OBJ with some segmentation settings.

However, in a Linux machine I’m tripping over the following error:

SetAndObserveColorToDisplayNode failed: invalid Colors module logic.

I’ve never seen this error in any discussion, bug tracker, or ticket that exists in Git or in this forum and so I was wondering if anyone had any ideas what might be causing this? A look into the VTK library finds that this is an error triggered by a null pointer in the color information node.

Any pointers?

Cheers.

SetAndObserveColorToDisplayNode failed: invalid Colors module logic.

You get this error because you instantiate new module logics. Instead, you need to use the existing, properly initialized module logic. For example: colorLogic = slicer.modules.colors.logic() .

WriteData: removing old version of file /root/output/52591e24-6ccd-4ae5-afd9-b689d1375291/4_ISOCENTER_VERIFICATION.nrrd

This is because you don’t have write access to that file. It is either because you don’t have write access to that folder or something locks that particular file. On linux a common issue was that sharing a single slicer instance between multiple users could result in having a read-only temporary folder. You can set the temporary folder path manually to fix this, or use the latest Slicer Preview Release, which automatically requests a new temporary folder from the operating system if the current folder is read-only.

1 Like

Your advice was exactly what was needed.

  • Using the existing, properly initialized modules instead of instantiating my own removed the Colors module error.

  • Either using the newest Slicer version or enforcing write-access on folders will remove the warning that there’s an old version of a file when there is none.

Thanks! I’ll leave this post up in case anyone else faces a similar issue.

1 Like

A post was split to a new topic: What are the underlying methods used in Segment Editor?