openDialog does not load node into scene

When using the openDialog function in the Slicer IO Manager, the selected node is not loaded into the scene.

For example, when I run the code below (see Documentation/Nightly/Developers/IO - Slicer Wiki), nothing happens after selecting a volume file to load.

 io = slicer.app.ioManager()
 params = {}
 io.openDialog("VolumeFile", slicer.qSlicerFileDialog.Read, params)

Is there a new preferred way to load files using a registered dialog?

Slicer version: 5.1.0-2022-05-16
OS: Windows 10

thanks for the report. yes, that appears to be a regression. For me either the code you pasted or slicer.util.openAddVolumeDialog() brings up a native dialog and always returns False. Can you file an issue on slicer github?

As a workaround, you can do something like this:

d = qt.QFileDialog()
d.exec()
slicer.util.loadVolume(d.selectedFiles()[0])
2 Likes

Thanks for the workaround. I have filed an issue on Slicer Github here: openDialog does not load node into scene · Issue #6429 · Slicer/Slicer · GitHub.

1 Like