Previous turning on individual slice intersection not working

Using an older Slicer version 2021-09-14 I was able to turn on a single slice intersection with the following:

slice_widget ="Red")
composite_node = slice_widget.sliceLogic().GetSliceCompositeNode()

but now with a recent Slicer version (2022-04-26) it doesn’t produce the same output. There is no red line observed in the green and yellow slice view:

Is this a bug? Is there a better way to turn on a single slice intersection as was attempted before?

Does this explain the change and helpful for updating your code?

^ Using the above code in latest Slicer preview I get the following warning which indicates that method is deprecated, but it doesn’t actually produce the same results as before. There seems to be broken backwards compatibility behavior introduced in ENH: Add back vtkMRMLSliceCompositeNode::SetSliceIntersectionVisibili… · Slicer/Slicer@0798137 · GitHub?

[WARNING][VTK] 28.04.2022 14:19:07 [vtkMRMLSliceCompositeNode (0000024DDED0EEB0)] (D:\D\P\S-0\Libs\MRML\Core\vtkMRMLSliceCompositeNode.cxx:301) - SetSliceIntersectionVisibility method is deprecated. Use SetIntersectingSlicesVisibility method of vtkMRMLSliceDisplayNode object instead.

Attempting to use a newer method I’m still unable to achieve the same results as previously (there is no red line in the green and yellow slice views upon calling SetIntersectingSlicesVisibility.

slice_widget ="Red")

Both the deprecated and the new methods work, but the changes only take effect if a slice nodes are updated, for example like this:

sliceNodes = getNodesByClass('vtkMRMLSliceNode')
for sliceNode in sliceNodes:

Of course this forced update should not be necessary. This is a regression introduced when the interactive slice intersection feature was introduced. We spent a lot of time trying to fix all the issues, but at some point we had to decide between rejecting this feature or get it in even though there are still problems with it. I think we fixed most of the issues that come up when using the GUI, but workarounds are needed when the feature is used programmatically.

You can submit a bug report and we’ll eventually get to it, but probably only when there is interest/funding for making interactive slice intersections fully functional (e.g., compatible with Segment Editor).

The force update works. I’ve issued DOC: Include workaround to force visual update of intersecting slices by jamesobutler · Pull Request #6339 · Slicer/Slicer · GitHub to update the documentation around the script repository example to include this update.

I’ve written up the bug report at Programmatically setting slice intersection visibility does not update slice views immediately · Issue #6338 · Slicer/Slicer · GitHub

For my specific case of updating a single slice view intersection the following works for me which is also using the non-deprecated API.

slice_widget ="Red")
1 Like