# How to access dicom widget components

**URL:** <https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844>\
**Category:** Development\
**Tags:** gui\
**Created:** [February 7, 2022, 7:40pm UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844 "2022-02-07T19:40:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [February 7, 2022, 7:40pm UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844/1 "2022-02-07T19:40:40Z")

</div>

How to access DICOM widget from Home / other module  
**slicer.modules.DICOMWidget.ui.label\_5.hide()**

Scenario: when we are starting a Slicer by default all module are not available in the Memory,  
In our scenario we are starting a Slicer with Home module in which we are trying to hide the DICOM module’s not required components. by using code like this **slicer.modules.DICOMWidget.ui.label\_5.hide()**.

What is the correct way to access the other module components in the selected module. OR How we can achieve this.

---

<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:** [February 8, 2022, 8:29pm UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844/2 "2022-02-08T20:29:46Z")

</div>

One option is to instantiate the DICOM module widget and modify its components. For example:

```python
dicomModuleWidget = slicer.util.getModuleGui('DICOM')
dicomModuleWidget.ui.dicomPluginsFrame.hide()

```

If there is anything that it is not trivial to change or not exposed nicely then please send a pull request or start a discussion about it here. For example, `label_5` is just a default widget name that can be renamed anytime to a proper meaningful name and then your code will not work anymore, therefore if you want to hide this label then it should be renamed to `labelLoadedData` or something similar.

> [@Dwij\_Mistry](#):
>
> when we are starting a Slicer by default all module are not available in the Memory

Modules are loaded in random order during application startup and then initialized based on an order determined from dependencies that each module declare. If you want to use any module from a Python scripted module then the simplest is to wait for the `slicer.app.startupCompleted()` signal.

---

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [February 9, 2022, 6:42am UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844/3 "2022-02-09T06:42:24Z")

</div>

Thank you very much @lassoan for your response.

> [@lassoan](#):
>
> ```auto
> dicomModuleWidget = slicer.util.getModuleGui('DICOM')
> dicomModuleWidget.ui.dicomPluginsFrame.hide()
> 
> ```

this is exactly what I was looking for.

> [@lassoan](#):
>
> If there is anything that it is not trivial to change or not exposed nicely then please send a pull request or start a discussion about it here

Yes sure, I found following labels name which we can change to something meaningful in the DICOM module.

 ![Screenshot (88)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/6/a653320753ef13ee9335499ed597897c58a1ce32.png)

| existing label name | Proposed label name |
| --- | --- |
| label\_5 | labelLoadedData |
| label | labelPullDataFromRemoteServer |
| label\_6 | labelStorageListener |
| labe\_7 | labelStartStorageListenerOnStartup |
| label\_8 | labelDatabaseLocation |
| label\_9 | labelAutoHideBrowserWindow |
| label\_10 | labelMaintenance |

---

<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:** [February 9, 2022, 2:08pm UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844/4 "2022-02-09T14:08:10Z")

</div>

Please send a pull request with the suggested name changes.

Is the reason for accessing the labels that you want to hide them? If yes, then we could add API to show/hide entire sections. If you just want to rename or rearrange options (because they are not intuitive or convenient enough) then it might be better to make those changes directly in Slicer core.

---

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [February 9, 2022, 3:26pm UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844/5 "2022-02-09T15:26:50Z")

</div>

Yes pull request created [ENH: given meaningful names to labels by dwijmistry11 · Pull Request #6171 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/6171)

> [@lassoan](#):
>
> If you just want to rename or rearrange options (because they are not intuitive or convenient enough) then it might be better to make those changes directly in Slicer core.

We resoled this issue by creating clone of DICOM module in the template; in which we hide the non frequently used part.

> [@lassoan](#):
>
> Is the reason for accessing the labels that you want to hide them?

We can have a Setting tab or something like that, to reduce complexity.  
But in latest release those all settings are having expandable and collapsable section.

---

<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:** [February 9, 2022, 3:36pm UTC](https://discourse.slicer.org/t/how-to-access-dicom-widget-components/21844/6 "2022-02-09T15:36:50Z")

</div>

Maybe all the remote server stuff should be in an “Advanced” section of some sort with the focus on local import.
