Access Dicom metadata dialog

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

I tried the following code in python interactor

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

it is having all components but not having access of Metadata

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

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

# 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()
2 Likes

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

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

1 Like