@Sunderlandkyl
How to auto-hide browser window, when use slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDicomBrowserView) in python.
like this:
I have to reopen my moudle to switch. I need not the side bar. I found the Auto-hide browser window checkbox in ‘DICOM database settings’ layout. How to “Auto-hide browser window” with python.
You can use this function to change the browser persistence setting from Python: slicer.modules.dicom.widgetRepresentation().self().browserWidget.setBrowserPersistence(True)
Using a freshly started Slicer, running the following code in the python interactor does not cause the DICOM module to appear in the sidebar (tested on Windows & Linux):
Can you provide an example that can be run in the Python interactor that will cause the issue?
Otherwise, you may be able to debug the issue by placing a breakpoint in slicer.util.selectModule() and check the call stack to see where the module is changed.
@Sunderlandkyl
Thinks, my code use slicer.util.selectModule("DICOM"), I delete it.
def showDICOMBrowser(self):
if slicer.modules.DICOMInstance.browserWidget is None:
# slicer.util.selectModule('DICOM')
slicer.util.selectModule('PedicleTrianglePlaner')
# Make the DICOM browser disappear after loading data
slicer.modules.dicom.widgetRepresentation().self()
slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDicomBrowserView)
slicer.modules.dicom.widgetRepresentation().self().browserWidget.setBrowserPersistence(False)
@Sunderlandkyl Problem solved, thank you, teacher!
问题解决,谢谢老师