Hello, I have a folder of dicom files but would like to automatically load on patient onto the screen every time.
I have loaded my dicom files into the DICOM database using this code:
dicomDataDir = "c:/my/folder/with/dicom-files" # input folder with DICOM files
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))
How do I automatically access one patient and load it, do I have to use the patient uid and how do i find this?
In the example above, loadedNodeIDs contain the IDs of the loaded nodes. For example, you can get the first node object (for example, it can be a volume node) by calling:
n = slicer.mrmlScene.GetNodeByID(loadedNodeIDs[0])