How to access DICOM widget from Home / other module
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.
One option is to instantiate the DICOM module widget and modify its components. For example:
dicomModuleWidget = slicer.util.getModuleGui('DICOM')
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
Thank you very much @lassoan for your response.
this is exactly what I was looking for.
Yes sure, I found following labels name which we can change to something meaningful in the DICOM module.
|existing label name
||Proposed label name
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.
Yes pull request created https://github.com/Slicer/Slicer/pull/6171
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.
Maybe all the remote server stuff should be in an “Advanced” section of some sort with the focus on local import.