# Changing threshold in python does not update in any views

**URL:** <https://discourse.slicer.org/t/changing-threshold-in-python-does-not-update-in-any-views/20919>\
**Category:** Support\
**Tags:** threshold, python\
**Created:** [December 5, 2021, 10:04pm UTC](https://discourse.slicer.org/t/changing-threshold-in-python-does-not-update-in-any-views/20919 "2021-12-05T22:04:15Z")\
**Posts on this page:** 2\
**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 5, 2021, 10:04pm UTC](https://discourse.slicer.org/t/changing-threshold-in-python-does-not-update-in-any-views/20919/1 "2021-12-05T22:04:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [December 6, 2021, 12:06am UTC](https://discourse.slicer.org/t/changing-threshold-in-python-does-not-update-in-any-views/20919/2 "2021-12-06T00:06:36Z")

</div>

Make sure you have turned on thresholding for the display node. You can set threshold values with thresholding not enabled.

```python
volume_node.GetDisplayNode().ApplyThresholdOn()

```

This will essentially change the Threshold mode combobox selection from “Off” to “Manual”. It also changes to “Manual” after manually dragging the threshold slider.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/8/48e1d5f6957def4d20304ca19ca50061ce4329b2.png)
