# How to change the slice fill in 'Segmentations' in a python script

**URL:** <https://discourse.slicer.org/t/how-to-change-the-slice-fill-in-segmentations-in-a-python-script/20871>\
**Category:** Support\
**Tags:** segmentation, scripted\
**Created:** [December 1, 2021, 10:24pm UTC](https://discourse.slicer.org/t/how-to-change-the-slice-fill-in-segmentations-in-a-python-script/20871 "2021-12-01T22:24:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [December 1, 2021, 10:24pm UTC](https://discourse.slicer.org/t/how-to-change-the-slice-fill-in-segmentations-in-a-python-script/20871/1 "2021-12-01T22:24:11Z")

</div>

I created a .py script to automatically create some segmentations and now I also want to automatically change the slice fill to 0 and slice outline to 1. How can I do that? I can’t find the appropriate documentation.

Also a more general question: what’s the best way to look for code or commands that correspond to elements and actions in the user interface?

---

<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 2, 2021, 6:17pm UTC](https://discourse.slicer.org/t/how-to-change-the-slice-fill-in-segmentations-in-a-python-script/20871/2 "2021-12-02T18:17:46Z")

</div>

> [@koeglfryderyk](#):
>
> I created a .py script to automatically create some segmentations and now I also want to automatically change the slice fill to 0 and slice outline to 1. How can I do that? I can’t find the appropriate documentation.

Display settings are stored in the display node. See [example](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#modify-segmentation-display-options) and [API reference](http://apidocs.slicer.org/master/classvtkMRMLSegmentationDisplayNode.html) for details.

> [@koeglfryderyk](#):
>
> Also a more general question: what’s the best way to look for code or commands that correspond to elements and actions in the user interface?

We collect python scripting examples of all frequently used features in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html). If you don’t find something then you can look up by following the technique described [here](https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#how-to-find-a-python-function-for-any-slicer-features). If you get stuck then post here on the forum.

* * *

Do you have any suggestion of how to improve our documentation or make things easier to find? How did you try to find the relevant piece of documentation?

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [December 2, 2021, 7:26pm UTC](https://discourse.slicer.org/t/how-to-change-the-slice-fill-in-segmentations-in-a-python-script/20871/3 "2021-12-02T19:26:41Z")

</div>

Thanks, that worked beautifully!

At the moment I don’t have any suggestions. I can only say that I didn’t find the API Reference very helpful, what helped me the most was the script repository and questions posted here. I feel like examples were the most helpful.

If I come up with any suggestions I’ll make sure to share them
