Basically, you have to read the extracted DICOM files:
zip_path = patient.PATIENT_DICOM
with zipfile.ZipFile(zip_path, 'r') as zip:
path = tempfile.mkdtemp()
zip.extractall(path)
slices = []
for root, _, filenames in os.walk(path):
for filename in filenames:
filepath = os.path.join(root, filename)
slices.append(pydicom.dcmread(filepath))
shutil.rmtree(path)
Note that this first extracts all files into a temp dir, which is probably faster than accessing them one by one. This assumes, that all files in the zip belong to the same volume or series. If you want to work with the slices further, you have to sort them properly first, for example by InstanceNumber
.