Fastest way to load DICOM

Use the latest Slicer Preview Release, as DICOM import speed is greatly improved.

If you get scans one by one then you can import them one by one (by drag-and-dropping to the application window), loading them using DICOM browser, then save them as .nrrd.

If you have hundreds of files already then you can write a short Python script that iterates through all your data. You can use tools or scripts described in the topic that you referred above, or you can use a use/customize a simple script like this:

dicomDataDir = 'c:/tmp/inputDicomFiles'
outputDir = 'c:/tmp/outputNrrdFiles'

import DICOMLib
import re
DICOMLib.importDicom(dicomDataDir)
dicomFiles = slicer.util.getFilesInDirectory(dicomDataDir)
loadablesByPlugin, loadEnabled = DICOMLib.getLoadablesFromFileLists([dicomFiles])
loadedNodeIDs = DICOMLib.loadLoadables(loadablesByPlugin)
for loadedNodeID in loadedNodeIDs:
    node = slicer.mrmlScene.GetNodeByID(loadedNodeID)
    safeFileName = re.sub(r'(?u)[^-\w.]', '', node.GetName().strip().replace(' ', '_'))
    slicer.util.saveNode(node, '{0}/{1}.nrrd'.format(outputDir, safeFileName))
1 Like