I tried to write a program to open the folder and read several cases inside,but after I run it, only the data of the first case can be successfully loaded, and the following cases will report errors。My code and error message are as follows:
My code:
dicomDataDir = r"D:/test" #my folder
loadedNodeIDs = [] # this list will contain the list of all loaded node IDs
from DICOMLib import DICOMUtils
with DICOMUtils.TemporaryDICOMDatabase() as db:
DICOMUtils.importDicom(dicomDataDir, db)
patientUIDs = db.patients()
for patientUID in patientUIDs:
loadedNodeIDs.extend(DICOMUtils.loadPatientByUID(patientUID))
error message :
Loading with imageIOName: GDCM
Could not read scalar volume using GDCM approach. Error is: FileNotFoundError
Loading with imageIOName: DCMTK
Could not read scalar volume using DCMTK approach. Error is: FileNotFoundError
Failed to read a multivolume: Volume frame 0 is invalid - Reference image in series does not contain geometry information. Please use caution.
Traceback (most recent call last):
File "C:/Users/18729/AppData/Local/NA-MIC/Slicer 5.0.3/bin/../lib/Slicer-5.0/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 639, in load
raise OSError(f"Volume frame {frameNumber} is invalid - {svLoadables[0].warning}")
OSError: Volume frame 0 is invalid - Reference image in series does not contain geometry information. Please use caution.
The problem seems to be that the program doesn’t read the file.But the first file can be opened normally.anyone can help me?thanks!