I am attempting to take a series of dicom files, import them to slicer, then iterate over them to get the first file to use for data. currently, I have an issue where the import method I am using will get the data in the files properly and will display the volume in the 3 views, but If the dicomDatabase does not already have the patient, no patient will display there. the functions for iteration over the data also return no patient data. if the patient is already in the database from being imported manually, everything will work as expected.
this is the method i am currently using:
path = ‘PATH_TO_DIR’
ctk.ctkDICOMIndexer().addDirectory(slicer.dicomDatabase, path)
db = slicer.dicomDatabase
for patient in db.patients():
for study in db.studiesForPatient(patient):
for series in db.seriesForStudy(study):
files = db.filesForSeries(series)
I’ve been looking through the source for the DICOM and DICOMLib scripts, but most things I have found related to the database are only done through the widget rather than the logic.
What is the best way to do this, and trigger the update on the dicomDatabase with the new directory?