Slice views get reset when updated from cli output in a segment editor effect

Operating system: linux (ubuntu 20.04)
Slicer version: 5.2.1
Expected behavior: slice views are not reset, only segments change
Actual behavior: slice views are re-centered

My scripted segment editor effect sends segments to a cli module for modification. After the cli completes, the existing segmentation gets updated from the returned labelmap:

segmentationNode = self.scriptedEffect.parameterSetNode().GetSegmentationNode()
slicer.vtkSlicerSegmentationsModuleLogic.ImportLabelmapToSegmentationNode(
    self.output_labelmap_volume,
    segmentationNode,
    structure_segment_ids
)

The segments get updated appropriately, but in the process the slice views get reset to the center of the reference volume. The same code run in a Jupyter notebook outside of a segment editor effect does not reset the slice views. What could be the cause of this resetting? Is there a way to set up the segment editor effect or the input or output volume nodes to prevent it?

You can set update_display=False to prevent automatic display of CLI execution results.

That was it! Thank you very much.

1 Like