Faster DICOM loading

Hi, I’m loading DICOM series this way:

    from DICOMLib import DICOMUtils
    loadedNodeIDs = []
    with DICOMUtils.TemporaryDICOMDatabase() as db:
      DICOMUtils.importDicom(image_dicom_folder, db)
      patientUIDs = db.patients()
      for patientUID in patientUIDs:
    #print("image loaded:",image_dicom_folder)

for a DICOM series to load it takes around 25 seconds on a intel quad core 4.00GHz cpu and 32 GB of Ram.

I was wondering if this is something that I can improve in some way?


If you know that you only need to load 3D images (no 4D data, no 2D+t data, no DICOM segmentation objects, RT structure sets, etc.) then you can disable all DICOM plugins except the basic scalar volume reader plugin. To do that run these before starting the loading:

# Temporarily remove all DICOM plugins except DICOMScalarVolumePlugin
originalDicomPlugins = slicer.modules.dicomPlugins
slicer.modules.dicomPlugins = {'DICOMScalarVolumePlugin': originalDicomPlugins['DICOMScalarVolumePlugin']}

and in the end restore the original plugin list by running this:

# Restore original DICOM plugin list
slicer.modules.dicomPlugins = originalDicomPlugins
1 Like