Slicer is freezing on macOS when clicking on "Import DICOM files"

version 2021.07.08 on mac M1

once I press load Dicom , slicer freezes and nothing can be done. interestingly, when I try to force turn off, I don’t get ( not responding ) next to the app showing a freeze.

older versions worked fine till this

if i don’t try to load dicom it works fine

Thanks for reporting - perhaps this is due to the M1 chip. Try loading different data or if it’s unique to the data try the same data on a different machine and let us know.

im sorry i meant trying to import data , so once i click on import dicom it freezes

I think it is due to the recent change in the file selector popup (when you press “Import DICOM files”). As a workaround, you can drag-and-drop the DICOM folder to the application window.

@pieper could you test the “Import DICOM files” button on macOS?

Yes, I see the behavior too on my mac build. This is a pretty serious issue - do you know the fix?

Yes, it is a very serious issue, especially because it impacts those who are new to Slicer and don’t know they can just drag-and-drop the images. I guess the file dialog options in CTK are set incorrectly (maybe it does not appear or appears in some invisible place?) see changes in these commits:

Is this specific to the “Import DICOM files” button or is it a problem for all Qt native file dialog usage on macOS?

file_dialog = qt.QFileDialog()
file_dialog.getExistingDirectory()

Qt 5.15 can set the target platform to 10.13, 10.14, and 10.15 (see here). With the move to macOS 11 with M1 support maybe there are issues?

The native dialogs work fine, but this is a non-native dialog (has the “import” checkbox). Probably we should just switch to the native dialog and add the import/copy checkbox to the DICOM browser settings. I’ve added an issue to keep track the status of this:

Regardless of removing all non-native file selectors in Slicer, we should fix the non-native dialog in CTK.

@jamesobutler do you have access to a mac? Can you investigate/fix this?

The “Import DICOM files” button is using a native file dialog as of the change to native file dialog usage. See BUG: Fix crash instantiating ctkDICOMBrowser by jamesobutler · Pull Request #977 · commontk/CTK · GitHub. This is a snippet of the native dialog being used.

I do not have access to a mac to investigate this.

I see, yes, it is indeed a native dialog.

@pieper Could you investigate? There are a number of special flags set (bottomWidget, ApplicationModel, …) that may cause trouble.

Okay, I’ll have a look.

1 Like

This seems to be a bug related to Qt and macOS getting confused about multiple screens. @mohammed_alshakhas do you also have two screens on your mac?

It seems the location of the dialog can be off-screen so the application appears to hang because there’s a modal dialog you cannot see. It appears this can happen when the dialog position is calculated based on the main window location on one screen but is displayed on the other screen and ends up being off-screen.

There are similar problems with menus and tooltips popping up in the wrong locations too. When I get time I’ll check if there is an updated Qt version that might address this.

On my build I can get around this apparent hang by commenting out line 382 here:

With even with that change, there is something odd going on with the dialogs from the dicom module. if I start Slicer on one screen, then drag the app to another, then invoke one of the dicom dialogs (either import or query-retrieve) it will show up on the screen where Slicer was started. Other dialogs, like the load and save dialogs follow Slicer to the new screen. I don’t see any obvious reason why some dialogs would appear on one screen and some on the other. The import dialog is native and the query retrieve dialog is a QDialog.

So other than removing that one line and waiting for a better Qt fix I’m not sure what more can be done right now.

Depending on how this bug manifests it may be a workaround to remove your settings file like this rm -rf ~/.config/www.na-mic.org/.

I’ve tried it on a mac that has not been connected to an external screen for years and removed the entire ~/.config/www.na-mic.org/ folder and the issue is the same.

Maybe the issue is that the dialog is not displayed using exec or open but it just got shown and raised:

@pieper could you try if using exec or open to show the dialog fixes the problem?

@pieper Are you using Qt 5.15.2? From my memory I think we updated the factory macOS builds from 5.15.1 to 5.15.2 to resolve some issues with tool tips and menus and stuff.

This also reminds me as part of the new upcoming Slicer release all platforms should use the same Qt version which is currently not the case. @jcfr @Sam_Horvath

i do have multiple screen and i check on the other screen cause im familiar with that issue in other software .
to make i sure i don’t have that i do right click and `" show all windows" and that will show me if im missing the dialogue box.

thought about it and unfortunately did find any dialogue box on other screen.

i do have however other times where slicer by itself swipe to to other blank screen which is extremely ANNOYING

Agreed, there are some bugs in the Qt / macOS integration in terms of screens and spaces. The splash screen doesn’t show up right, the screen geometry is not saved/restored right, the dialogs and tooltips and even menus show up in the wrong places. I’ve gotten a bit used to them but I agree they are annoying.

Yes, I use qt 5.15.2 from homebrew.

According to the Qt roadmap 1.15.3 will be commercial-only and there won’t be a 6.2 with all the features we need until around September and it’s not clear if this will solve these issues or maybe introduce new ones. And of course macOS may introduce new features that break behavior.

I know it’s not realistic for everyone but I actually use my mac for general work but about half the time I’m using Slicer on a remote desktop to a linux VM where everything works nicely.

I would add that everything works well on Windows, too.

It seems that macOS keeps breaking things more quickly than Qt developers would be able/care to fix. And this is just the window management. It will take even more effort to maintain compatibility with macOS over the coming years due to deprecation of OpenGL and Intel CPUs. Also, Apple is not participating in other standardization efforts, such as OpenXR for virtual/augmented reality. Overall, Apple seem to want to seize complete control at all level, which is really good for them and allows them to do some optimizations and simplifications in their hardware and software stack, but it makes their products increasingly problematic platforms for open, cross-platform applications.

Any idea what the breakdown of download is for Windows/Mac/Linux ? I know it is a crude approximation of actual usage by platform. But at least it would give some indication…

https://download.slicer.org/download-stats/

image

We certainly don’t want to give up on mac, but the points Andras makes are valid.

@pieper @muratmaga for an average user like me who depends macos environment, it is semi impossible to shift for windows . i gave up the idea of many softwares for this reason ,
plus
with mac im using much less powerful machines than i would need with windows . im writing from my 10 years old mac machine which i use for slicer without any issues .
id say that if it wasn’t mac compatible i would have lost the chance to work on slicer
i love slicer and i hope that continue using on macOS .

Screen Shot 2021-07-15 at 20.31.03