# Adjust opacity of scalar value

**URL:** https://discourse.slicer.org/t/adjust-opacity-of-scalar-value/18519
**Category:** Development
**Created:** [July 5, 2021, 2:19pm UTC](https://discourse.slicer.org/t/adjust-opacity-of-scalar-value/18519 "2021-07-05T14:19:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![seanchoi0519](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/seanchoi0519/32/10354_2.png) [@seanchoi0519](https://discourse.slicer.org/u/seanchoi0519)
#### Post date: [July 5, 2021, 2:19pm UTC](https://discourse.slicer.org/t/adjust-opacity-of-scalar-value/18519/1 "2021-07-05T14:19:43Z")

</div>

Hello,

Just wondering if it’s possible to adjust the opacity of a model’s scalar (not the opacity of the model display node) programmatically?

For example, something like:  
model.GetDisplayNode().SetScalarOpacity(x)  
NOT model.GetDisplayNode().SetOpacity(x)

Thanks in advance

---

<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: [July 9, 2021, 5:09am UTC](https://discourse.slicer.org/t/adjust-opacity-of-scalar-value/18519/2 "2021-07-09T05:09:07Z")

</div>

You can specify opacity in the color node that you use for displaying the scalars. See complete example [here](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#create-custom-color-table). The last argument of `SetColor` method is the alpha (opacity) value.
