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.
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.
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.
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.
We resoled this issue by creating clone of DICOM module in the template; in which we hide the non frequently used part.
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.