# Get/Set GUI data from Python

**URL:** https://discourse.slicer.org/t/get-set-gui-data-from-python/23256
**Category:** Support
**Created:** [May 3, 2022, 9:37am UTC](https://discourse.slicer.org/t/get-set-gui-data-from-python/23256 "2022-05-03T09:37:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Marc-3d](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marc-3d/32/14931_2.png) [@Marc-3d](https://discourse.slicer.org/u/Marc-3d)
#### Post date: [May 3, 2022, 9:37am UTC](https://discourse.slicer.org/t/get-set-gui-data-from-python/23256/1 "2022-05-03T09:37:17Z")

</div>

Hi everyone,

I am trying write a Python script that accesses the “volume” node and “ROI” nodes that the user has manually selected in the “Volume Rendering” module.

Does anyone have any clues on how to access this information from Python?

Thank you in advance 🙂

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [May 3, 2022, 9:57am UTC](https://discourse.slicer.org/t/get-set-gui-data-from-python/23256/2 "2022-05-03T09:57:56Z")

</div>

This should help:

```auto
volRenLogic = slicer.modules.volumerendering.logic()
displayNode = volRenLogic.GetFirstVolumeRenderingDisplayNode(volumeNode)
roiNode = displayNode.GetROINode()

```

---

<div class="post-metadata">

### Author: ![Marc-3d](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marc-3d/32/14931_2.png) [@Marc-3d](https://discourse.slicer.org/u/Marc-3d)
#### Post date: [May 3, 2022, 11:30am UTC](https://discourse.slicer.org/t/get-set-gui-data-from-python/23256/3 "2022-05-03T11:30:07Z")

</div>

Thank for the answer, but what is “volumeNode” in your example? An empty “vtkMRMLScalarVolumeNode”?

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [May 3, 2022, 12:48pm UTC](https://discourse.slicer.org/t/get-set-gui-data-from-python/23256/4 "2022-05-03T12:48:40Z")

</div>

`volumeNode = getNode("nodeNameInTheDataModule")`

---

<div class="post-metadata">

### Author: ![Marc-3d](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marc-3d/32/14931_2.png) [@Marc-3d](https://discourse.slicer.org/u/Marc-3d)
#### Post date: [May 11, 2022, 4:02pm UTC](https://discourse.slicer.org/t/get-set-gui-data-from-python/23256/5 "2022-05-11T16:02:17Z")

</div>

The problem is that I don’t know the name of the volumeNode in advance, or it’s ID.

I ended up figuring out how to access the GUI element that holds the list of volumes. Maybe it helps someone else in the future 🙂

```
vol_node = slicer.modules.volumerendering.widgetRepresentation().findChild(slicer.qMRMLNodeComboBox(), "VolumeNodeComboBox").currentNode();
```
