I am trying to make an extension I am developing robust when launched right after Slicer install, where DICOM database is not initialized. I would like to understand 1) how to detect this; 2) how to address this.
What is confusing is that when I start Slicer for the first time, and open DICOM browser, I see the below:
I have to say this was not intuitive at all to me. The problem is that those database variables are initialized even though the database itself is not. So instead of checking that database is non-null, one needs to check if databaseFilename corresponds to an existing file. It is also super confusing that one needs to know where the pre-determined DICOM DB folder is located if one needs to delete it to reset Slicer installation to pristine state.
In any case, this is the solution:
I spent couple of hours earlier today trying to figure this out. Hope this will help someone else avoid my fate!