# DICOM Browser Layout

**URL:** https://discourse.slicer.org/t/dicom-browser-layout/8148
**Category:** Support
**Tags:** feature, dicombrowser
**Created:** [August 23, 2019, 4:40pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148 "2019-08-23T16:40:07Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)
#### Post date: [August 23, 2019, 4:40pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/1 "2019-08-23T16:40:07Z")

</div>

The latest nightly builds on all platforms include an updated DICOM browser that is embedded within a layout, rather than as a popup window.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/b/6bb2c65c01b78aa2638b639211d2345b7e6dfd2e.png)

To show the dicom browser within a module:  
`slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDicomBrowserView)`

If anybody has any feedback or encounters any issues with the new DICOM browser layout, it would be great if you could post them here.

Thanks,  
Kyle

---

<div class="post-metadata">

### Author: ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)
#### Post date: [November 15, 2021, 2:29am UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/2 "2021-11-15T02:29:43Z")

</div>

@Sunderlandkyl  
How to auto-hide browser window, when use ` slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDicomBrowserView)` in python.  
like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/0/b08d10bc40189f5aa6a3dc5c4685e01e0baa1671.png)

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/e/0e139a6ea05deb0992e360f1cbd91ff023fa3d17.png)

---

<div class="post-metadata">

### Author: ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)
#### Post date: [November 15, 2021, 2:42am UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/3 "2021-11-15T02:42:10Z")

</div>

@lassoan@Juicy@jamesobutler @jcfr @pieperThanks @chir.set@Sunderlandkyl

---

<div class="post-metadata">

### Author: ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)
#### Post date: [November 15, 2021, 3:35pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/4 "2021-11-15T15:35:41Z")

</div>

It should automatically switch back to the previous layout when something is loaded.  
Have you encountered any issues with this?

---

<div class="post-metadata">

### Author: ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)
#### Post date: [November 15, 2021, 7:47pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/5 "2021-11-15T19:47:30Z")

</div>

@Sunderlandkyl  
Yes, the previous layout has automatically switch, but the side bar still couldn’t switch back…

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/9/e96150e9f370aa03bc95f8d9cac85f064c18a848.jpeg)

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.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/e/0e139a6ea05deb0992e360f1cbd91ff023fa3d17.png)

---

<div class="post-metadata">

### Author: ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)
#### Post date: [November 15, 2021, 8:05pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/6 "2021-11-15T20:05:18Z")

</div>

You can use this function to change the browser persistence setting from Python:  
`slicer.modules.dicom.widgetRepresentation().self().browserWidget.setBrowserPersistence(True)`

---

<div class="post-metadata">

### Author: ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)
#### Post date: [November 15, 2021, 8:32pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/7 "2021-11-15T20:32:40Z")

</div>

> [@Sunderlandkyl](#):
>
> slicer.modules.dicom.widgetRepresentation().self().browserWidget.setBrowserPersistence(True)

```auto
slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDicomBrowserView)
slicer.modules.dicom.widgetRepresentation().self().browserWidget.setBrowserPersistence(False)

```

I use above code, but open the Slicer, the first time “load DICOM”, the sidebar appears, and then “load DICOM”, the sidebar will not appear…Why?

---

<div class="post-metadata">

### Author: ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)
#### Post date: [November 15, 2021, 9:00pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/8 "2021-11-15T21:00:25Z")

</div>

![ScreenFlow](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/0/602375f7aeef86ce7dc1cfe23d6b5b75b42f9305.gif)

Open the Slicer, the first time “load DICOM”, the sidebar appears, and then “load DICOM”, the sidebar will not appear…

打开Slicer,第一次“load DICOM”, 侧边栏出现, 此后再“load DICOM”,侧边栏就不会出现了…

---

<div class="post-metadata">

### Author: ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)
#### Post date: [November 15, 2021, 9:21pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/10 "2021-11-15T21:21:57Z")

</div>

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):

```auto
slicer.modules.dicom.widgetRepresentation().self()
slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDicomBrowserView)
slicer.modules.dicom.widgetRepresentation().self().browserWidget.setBrowserPersistence(False)

```

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.

---

<div class="post-metadata">

### Author: ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)
#### Post date: [November 15, 2021, 9:47pm UTC](https://discourse.slicer.org/t/dicom-browser-layout/8148/11 "2021-11-15T21:47:25Z")

</div>

@Sunderlandkyl  
Thinks, my code use `slicer.util.selectModule("DICOM")`, I delete it.

```auto
  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!  
问题解决,谢谢老师
