# Access Dicom metadata dialog

**URL:** <https://discourse.slicer.org/t/access-dicom-metadata-dialog/21868>\
**Category:** Support\
**Tags:** dicombrowser\
**Created:** [February 9, 2022, 12:12pm UTC](https://discourse.slicer.org/t/access-dicom-metadata-dialog/21868 "2022-02-09T12:12:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahnawaz\_Vora](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahnawaz_vora/32/13667_2.png) [@Shahnawaz\_Vora](https://discourse.slicer.org/u/Shahnawaz_Vora)\
**Post date:** [February 9, 2022, 12:12pm UTC](https://discourse.slicer.org/t/access-dicom-metadata-dialog/21868/1 "2022-02-09T12:12:15Z")

</div>

Operating system: Windows 11  
Slicer version: 4.13

I am looking to access DICOM tag(metadata) display dialog by using button.  
Currently we are the same operation by right click on database.  
How can I access ctkBrowserWidget function and achieve this using Python.  
I got one script on slicer script repository  
dicomBrowser = slicer.modules.DICOMWidget.browserWidget.dicomBrowser  
But doesn’t helped me much

[https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/a/1a800d95543546e166d3f2f58bbe2db0a5d45b81.mp4](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/a/1a800d95543546e166d3f2f58bbe2db0a5d45b81.mp4)

---

<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, 4:36pm UTC](https://discourse.slicer.org/t/access-dicom-metadata-dialog/21868/2 "2022-02-09T16:36:16Z")

</div>

I tried the following code in python interactor

```auto
slicer.modules.DICOMWidget.browserWidget.dicomBrowser.children()

```

it is having all components but not having access of Metadata

 ![Screenshot (89)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/d/fddad2dcc90f16996ffdad619c1b3e068cc63203.png)

Does we are having any other way to access DICOM metadata popup?

---

<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 10, 2022, 7:35pm UTC](https://discourse.slicer.org/t/access-dicom-metadata-dialog/21868/3 "2022-02-10T19:35:03Z")

</div>

Using Qt introspection (accessing widgets using `children()`) is the very last resort if all else fail. Instead, public API of classes should be used.

```python
# Get the currently selected series ID
seriesInstanceUIDs = dicomBrowser.dicomTableManager().seriesTable().currentSelection
seriesInstanceUID = seriesInstanceUIDs[0] # just use the first series in this example
# Get the DICOM file paths for this series
files = slicer.dicomDatabase.filesForSeries(seriesInstanceUID)
# Show metadata viewer
metadataViewer = ctk.ctkDICOMObjectListWidget()
metadataViewer.setFileList(files)
metadataViewer.show()

```

---

<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 11, 2022, 5:12am UTC](https://discourse.slicer.org/t/access-dicom-metadata-dialog/21868/4 "2022-02-11T05:12:05Z")

</div>

Thank you @lassoan for the valuable replay.  
It worked flawlessly.

> [@lassoan](#):
>
> Using Qt introspection (accessing widgets using `children()` ) is the very last resort if all else fail. Instead, public API of classes should be used.

Sure, first I will look for public API then other things.
