# How to use Python to achieve the thresholding effect of the ‘Volumes’ module? (synchronized with the volume rendering)

**URL:** <https://discourse.slicer.org/t/how-to-use-python-to-achieve-the-thresholding-effect-of-the-volumes-module-synchronized-with-the-volume-rendering/20891>\
**Category:** Support\
**Tags:** threshold, python, volume-rendering\
**Created:** [December 2, 2021, 10:13pm UTC](https://discourse.slicer.org/t/how-to-use-python-to-achieve-the-thresholding-effect-of-the-volumes-module-synchronized-with-the-volume-rendering/20891 "2021-12-02T22:13:31Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [December 6, 2021, 4:32pm UTC](https://discourse.slicer.org/t/how-to-use-python-to-achieve-the-thresholding-effect-of-the-volumes-module-synchronized-with-the-volume-rendering/20891/14 "2021-12-06T16:32:19Z")

</div>

Providing a link to where a solution was provided for @koeglfryderyk 's issue.

> [@Changing threshold in python does not update in any views](https://discourse.slicer.org/t/changing-threshold-in-python-does-not-update-in-any-views/20919):
>
> I want to use a shortcut to change the lower threshold of a foreground US volume to 1 (so that the black surrounding pixels disappear). I used the code from [here](https://discourse.slicer.org/t/how-to-use-python-to-achieve-the-thresholding-effect-of-the-volumes-module-synchronized-with-the-volume-rendering/20891/9), and this code changes the threshold in the GUI, however, it doesn’t ‘propagate’ to any of the views - nothing changes there. I still need to manually nudge the slider/value a bit for the view to be updated. Is there any command that needs to be executed for the view to be updated?

---

_[View the full topic](https://discourse.slicer.org/t/how-to-use-python-to-achieve-the-thresholding-effect-of-the-volumes-module-synchronized-with-the-volume-rendering/20891)._
