# How to access the threshold slider in volume rendering module through python?

**URL:** <https://discourse.slicer.org/t/how-to-access-the-threshold-slider-in-volume-rendering-module-through-python/34820>\
**Category:** Support\
**Created:** [March 11, 2024, 12:30pm UTC](https://discourse.slicer.org/t/how-to-access-the-threshold-slider-in-volume-rendering-module-through-python/34820 "2024-03-11T12:30:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebin1234](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebin1234/32/70096_2.png) [@ebin1234](https://discourse.slicer.org/u/ebin1234)\
**Post date:** [March 11, 2024, 12:30pm UTC](https://discourse.slicer.org/t/how-to-access-the-threshold-slider-in-volume-rendering-module-through-python/34820/1 "2024-03-11T12:30:06Z")

</div>

Hello, I would like to know how to access the threshold slider in volume rendering module through python. By changing the threshold values in the code will change the upper and lower limits of the slider. The scalar opacity mapping should shows step function in the graph.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 11, 2024, 12:37pm UTC](https://discourse.slicer.org/t/how-to-access-the-threshold-slider-in-volume-rendering-module-through-python/34820/2 "2024-03-11T12:37:52Z")

</div>

The general guidelines are here:

[https://slicer.readthedocs.io/en/latest/developer\_guide/python\_faq.html#how-to-find-a-python-function-for-any-slicer-features](https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#how-to-find-a-python-function-for-any-slicer-features)

---

<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:** [March 12, 2024, 4:09am UTC](https://discourse.slicer.org/t/how-to-access-the-threshold-slider-in-volume-rendering-module-through-python/34820/3 "2024-03-12T04:09:16Z")

</div>

Shifting the transfer functions like the Shift slider does it in Volume Rendering module is a very finicky, unstable operation. The Volume Rendering module must be very general-purpose, so we don’t have much options. However, in your own module I would recommend to directly set the transfer function you want (similarly how it is done for example in [Colorize volume module](https://github.com/PerkLab/SlicerSandbox/blob/master/ColorizeVolume/ColorizeVolume.py#L491-L544)).
