googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.2k stars 722 forks source link

Only partial DICOM slices loading in Google Colab using imageio.volread #4422

Open Ede1994 opened 8 months ago

Ede1994 commented 8 months ago

I'm encountering an issue while trying to load DICOM files using imageio.volread in Google Colab. I have a folder containing 27 DICOM layers, but when I try to load them using the following code snippet:

import imageio

folder_path = 'Data/Brain/SE000001'
vol = imageio.volread(folder_path, 'DICOM')
print('Shape of image array:', vol.shape)

Only 5 out of the 27 layers are being loaded. So I get the output:

Warning: missing file after '/content/ImageAnalysis/ImageAnalysis/Data/Brain/SE000001/MR000023'
Reading DICOM (examining files): 27/27 files (100.0%)
  Found 6 correct series.
Reading DICOM (loading data): 5/5  (100.0%)
Shape of image array: (5, 256, 256)

The volume (27 slices) is 3.8MB in size.

This code works fine in my local Jupyter Notebook within VS Code, but not in Google Colab. I've checked the file paths and they seem to be correct. Are there any known issues with imageio.volread in Google Colab or any potential workarounds for this problem?

I've also tried imageio.v2 and imageio.v3, the problem is still the same. I only get the warning on Colab. The version imageio==2.34 is running on both systems. I imported the files into Google Colab at the beginning using !git clone. If I use pydicom, for example, I can also load the pixel data from all files, I don't get any errors.

Any help or insights would be greatly appreciated! Thanks!

cperry-goog commented 8 months ago

There are no known issues and it's unclear what might be causing this in Colab, keeping this open in case we get other reports.