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

**URL:** https://discourse.slicer.org/t/slice-views-get-reset-when-updated-from-cli-output-in-a-segment-editor-effect/26782
**Category:** Development
**Created:** [December 17, 2022, 2:34am UTC](https://discourse.slicer.org/t/slice-views-get-reset-when-updated-from-cli-output-in-a-segment-editor-effect/26782 "2022-12-17T02:34:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_Gilman](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_gilman/32/17737_2.png) [@Alex\_Gilman](https://discourse.slicer.org/u/Alex_Gilman)
#### Post date: [December 17, 2022, 2:34am UTC](https://discourse.slicer.org/t/slice-views-get-reset-when-updated-from-cli-output-in-a-segment-editor-effect/26782/1 "2022-12-17T02:34:47Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [December 17, 2022, 2:06pm UTC](https://discourse.slicer.org/t/slice-views-get-reset-when-updated-from-cli-output-in-a-segment-editor-effect/26782/2 "2022-12-17T14:06:35Z")

</div>

You can set [`update_display=False`](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.cli.runSync) to prevent automatic display of CLI execution results.

---

<div class="post-metadata">

### Author: ![Alex\_Gilman](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_gilman/32/17737_2.png) [@Alex\_Gilman](https://discourse.slicer.org/u/Alex_Gilman)
#### Post date: [December 17, 2022, 3:32pm UTC](https://discourse.slicer.org/t/slice-views-get-reset-when-updated-from-cli-output-in-a-segment-editor-effect/26782/3 "2022-12-17T15:32:21Z")

</div>

That was it! Thank you very much.
