Load DICOM via python and ignore 'Warnings detected during load' dialog


The latest version of Slicer has added a pop-up confirmation dialog when DICOM series are loaded which contain errors. This directs the user to look at the Advanced Information panel in the DICOM browser to find the warnings, or press OK to continue.

When using ‘–no-main-window’ and ‘–python-script’ flags to run some code which imports DICOMs, this dialog is not displayed and the script hangs at this point.

Is there any way to accept this warning when loading DICOMs in this way? Either programatically or having the dialog box displayed?



Unfortunately, widget and logic are mixed in DICOM module. It would need significant rework to nicely separate them - I’ve added a ticket to track this task: https://issues.slicer.org/view.php?id=4655

Until it is fixed (probably will not happen soon unless some dedicated funding arrives or somebody volunteers), you can change warnUserIfLoadableWarningsAndProceed function in DICOMWidgets.py in your local Slicer installation to not display a popup but for example write the warnings to a log file instead: