I am testing my extensions in a docker container and I have messages like this one
1: Traceback (most recent call last):
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOM.py", line 115, in performPostModuleDiscoveryTasks
1: self.setDetailsPopup(DICOMWidget.getSavedDICOMDetailsWidgetType()())
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 1019, in __init__
1: super(DICOMDetailsWindow, self).__init__(dicomBrowser, parent)
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 988, in __init__
1: DICOMDetailsBase.__init__(self, dicomBrowser)
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 94, in __init__
1: self.promptForDatabaseDirectory()
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 526, in promptForDatabaseDirectory
1: self.dicomBrowser.schemaUpdateAutoCreateDirectory = True
1: AttributeError: 'NoneType' object has no attribute 'schemaUpdateAutoCreateDirectory'
The test command is like
1: Test command: /usr/src/Slicer-build/Slicer-build/Slicer "--no-splash" "--testing" "--launcher-additional-settings" "/builds/dosimetry4d-build/AdditionalLauncherSettings.ini" "--no-main-window" "--additional-module-paths" "/builds/dosimetry4d-build/lib/Slicer-4.11/qt-scripted-modules" "/builds/dosimetry4d-build/lib/Slicer-4.11/cli-modules" "/builds/dosimetry4d-build/lib/Slicer-4.11/qt-loadable-modules" "--python-code" "import slicer.testing; slicer.testing.runUnitTest(['/builds/dosimetry4d-build/Dosimetry4D/Logic', '/builds/project-0/Dosimetry4D/Logic'], 'Dosimetry4DTest')"
I have tried to write the DatabaseDirectory
variable inside the ini with
sed '/\[General\]/a DatabaseDirectory=/usr/src/SlicerDB' /builds/dosimetry4d-build/AdditionalLauncherSettings.ini
and also to set up a function that forces slicer to have a temporal database as in the DICOMWidgets example like this one
def forceSlicerDB():
'''
forces Slicer to initialize a temporary database
'''
if not hasattr(slicer, 'dicomDatabase') or not hasattr(slicer.modules, 'dicom'):
databaseDirectory = Path("/usr/src/SlicerDB")
databaseDirectory.touch()
DICOMLib.DICOMWidgets.settings.setValue('DatabaseDirectory', str(databaseDirectory))
slicer.dicomDatabase = ctk.ctkDICOMDatabase()
slicer.dicomDatabase.openDatabase(str(databaseDirectory / "ctkDICOM.sql"), "SLICER")
slicer.app.setDICOMDatabase(slicer.dicomDatabase)
DICOMLib.setDatabasePrecacheTags()
# slicer.modules.DICOMInstance.performPostModuleDiscoveryTasks()
But no success so far, what am I doing wrong in these approaches?
Calling slicer.modules.DICOMInstance.performPostModuleDiscoveryTasks()
just raises a non database exception
1: Traceback (most recent call last):
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOM.py", line 115, in performPostModuleDiscoveryTasks
1: self.setDetailsPopup(DICOMWidget.getSavedDICOMDetailsWidgetType()())
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 1019, in __init__
1: super(DICOMDetailsWindow, self).__init__(dicomBrowser, parent)
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 988, in __init__
1: DICOMDetailsBase.__init__(self, dicomBrowser)
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 94, in __init__
1: self.promptForDatabaseDirectory()
1: File "/usr/src/Slicer-build/Slicer-build/lib/Slicer-4.11/qt-scripted-modules/DICOMLib/DICOMWidgets.py", line 526, in promptForDatabaseDirectory
1: self.dicomBrowser.schemaUpdateAutoCreateDirectory = True
1: AttributeError: 'NoneType' object has no attribute 'schemaUpdateAutoCreateDirectory'