# Python call for segmentation node selector in the view controller

**URL:** <https://discourse.slicer.org/t/python-call-for-segmentation-node-selector-in-the-view-controller/25554>\
**Category:** Support\
**Created:** [October 5, 2022, 5:40am UTC](https://discourse.slicer.org/t/python-call-for-segmentation-node-selector-in-the-view-controller/25554 "2022-10-05T05:40:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BraDan](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@BraDan](https://discourse.slicer.org/u/BraDan)\
**Post date:** [October 5, 2022, 5:40am UTC](https://discourse.slicer.org/t/python-call-for-segmentation-node-selector-in-the-view-controller/25554/1 "2022-10-05T05:40:30Z")

</div>

Hi everybody,

I am working with multiple segmentations. When entering:  
sliceController = slicer.app.layoutManager().sliceWidget(“Red”).sliceController()  
sliceController.toggleSegmentationOutlineFill()  
I am able to toggle through the fill states of the segmentation selected in the segmentation node selector. But I struggle to find a python call to switch to another segmentation - I have to select it manually out of the dropdown menu in the slice viewer window.  
So my Question is: Is there any way I can specify in the Python Interactor which segmentation the .toggleSegmentationOutlineFill() Method refers to?

Thanks!

![Screenshot 2022-10-04 214919](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/1/015f2b9c49a6aa51ea47dbe3040d3c64e92653d1.jpeg)

Operating system: WIn11  
Slicer version: 5.0.3

---

<div class="post-metadata">

**Author:** ![BraDan](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@BraDan](https://discourse.slicer.org/u/BraDan)\
**Post date:** [October 16, 2022, 6:48pm UTC](https://discourse.slicer.org/t/python-call-for-segmentation-node-selector-in-the-view-controller/25554/2 "2022-10-16T18:48:27Z")

</div>

In case anybody is interested, another approach works using the display node of the segmentation node in question, for example to enable 2D FIll and Outline:

`segmentationNode.GetDisplayNode().SetVisibility2DFill(True)`  
`segmentationNode.GetDisplayNode().SetVisibility2DOutline(True)`

---

<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:** [October 20, 2022, 8:58pm UTC](https://discourse.slicer.org/t/python-call-for-segmentation-node-selector-in-the-view-controller/25554/3 "2022-10-20T20:58:35Z")

</div>

Node selector in that widget is not exposed via MRML, so you need to drill down in the GUI to get to the segmentation node selector widget in the slice view controller. There are examples in the script repository and there have been similar questions on this forum that should get you there, but if you get stuck then let us know how far you got and we’ll help you with the rest.
