Methods to Make 3D Segment Editor Faster

Hi,

Currently, the 3D segment editor tool is running very slowly on my laptop whenever I try to segment a 3D volume.

I was wondering if there were any methods to make this process faster?

Thanks

I just had the same issue and noticed that the GPU memory size in the Volume Rendering / Advanced widget had been reset to 128MB. Setting it back to 6GB (which my video card supports) got it back to it’s old snappy self. YMMV.

I’ve added the following in the startup code of my scripts:

volumeRenderingGPUNode = slicer.util.getNodesByClass('vtkMRMLGPURayCastVolumeRenderingDisplayNode')[0]
volumeRenderingGPUNode.SetGPUMemorySize(6144)
2 Likes

Hi, I set mine back to 4GP as that is what my video card supports, and it does in fact run faster then before, but not as fast as I need it to be. Do you have any other tips/tricks to make segmentation in 3D views faster? (Through scripts)

I managed to make it a bit faster by increasing the scaling for volume rendering through scripts (using Crop Volume).
However, it still does not run fast enough.
Would one issue perhaps creating a 3D Closed Surface rather then a Binary LabelMap? What is the difference between the two? If I were to instead create a binary labelmap to edit from could I use the same script I’ve been using to activate/run the Segment Editor?
Would anyone have any example scripts for conversion to Binary Label Map?

Thanks

The reason it’s slow is probably because you have Show 3D turned on, and whenever your segmentation changes it updates the 3D surface. You don’t need the surface for segmentation, it is only a visual aid. The underlying representation that you edit in Segment Editor is actually a binary labelmap, and conversion is done automatically. Please refer to this page:
https://www.slicer.org/wiki/Documentation/Nightly/Modules/Segmentations

It would be possible to not convert to surface but do volume rendering without any conversion, but it has not been added yet. In the meantime you can turn off 3D and only show it when necessary.

You can get very fast 3D updates if you disable surface smoothing (see checkbox in drop-down menu of Show 3D button).

4 Likes

Thank you so much for all the help and quick replies!

Sorry I have one more quick question about this.
I know how to disable surface smoothening by setting “smoothing factor” to 0 using the segmentation node:
seg.GetSegmentation().SetConversionParameter(‘Smoothing factor’,‘0.0’)
before activating the segment editor widget.

However, how do I enable the surface smoothening display again once I turn off any segment editor affects, or when I do:
segmentEditorWidget.setActiveEffectByName(“None”)
When I do seg.GetSegmentation().SetConversionParameter(‘Smoothing factor’,‘0.5’) nothing happens and it still stays unsmoothened.

Also, I was wondering how to set the diameter of the brush in segment editor to a specific size (ie 10%) through scripts?

I guess you just need to request conversion again using the new conversion parameter:

seg.GetSegmentation().CreateRepresentation('Closed surface', True) # Last parameter forces conversion even if it exists
seg.Modified() # Update display
2 Likes

That did the trick, thanks a bunch.

1 Like