Not imported DICOM files

I could see that Slicer for Linux is not able to load all the DICOM files present in a folder. I have checked the following checks:

  • Files exist: yes
  • Slicer for Windows loads them: yes
  • The files contain data: yes
  • Are errors or warnings during import: no

What could be the steps to follow? What else should I check?
Any help is appreciated!

Perhaps narrow down to two files, one that loads and one that doesn’t and inspect what’s possibly different about them.

Do you mean internally, all the DICOM tags?

Probably not the dicom tags if the files load correctly on windows, but maybe something about the file path or permissions. It’s hard to think of any reason two versions of slicer would treat the same dicom files differently.

I have noticed that files are missing when Slicer loads a folder with DICOM content.
I wanted to share this simple script to generate a CSV file to check name by name which files are missing from the list in Slicer:

import pydicom
import sys
import csv
import os

from os import listdir
from os.path import join,isfile

def main():
    input_dir = sys.argv[1]
    output_file = sys.argv[2]
    ds_dict = {               
                "PatientID": None,       
                "FileName": None,
                "SeriesNumber": None,     
                "SeriesDescription": None,
                "Modality": None}      
    input_dir = os.path.abspath(input_dir)

    with open(output_file, 'a') as f:
        w = csv.DictWriter(f, ds_dict.keys())
        for root, dirs, files in os.walk(input_dir):
            for file in files:
                file_abspath = os.path.join(input_dir, file)
                if file_abspath.endswith('EXTREME'):
                        ds = pydicom.dcmread(file_abspath, force=True)
                        ds_dict["FileName"] =             str(file)
                        ds_dict["PatientID"] =            str(ds.PatientID)
                        ds_dict["SeriesNumber"] =         str(ds.SeriesNumber)
                        ds_dict["SeriesDescription"] =    str(ds.SeriesDescription)
                        ds_dict["Modality"] =             str(ds.Modality)
                        ds_dict = ds_dict.fromkeys(ds_dict, None)
                    except Exception as ex:

if __name__ == "__main__":

To run it, just type it in the command line:

python input_folder/ output.csv

The generated CSV file can be opened with any spreadsheet software. By copying the unloaded file to a separate folder and importing it with the “Import DICOM” tool, I can load the missing files one by one.

So this indicates that the files didn’t load due to something about the folder they were originally in?

Nope, I checked by moving the parent directory to see if it could be due to a too long path. But the files are arbitrarily missing

Is there a way you can turn this into a report that can be reproduced on other machines?

Do you mean by sharing the DICOM files I use (I should consult it) or with a public example DB? I could get an estimate of what is missing in proportion to those that exist.

What I mean is that it’s not clear if this is an issue with the files or your system of if it’s something to do with Slicer itself. If you are able to provide a set of data and instructions that can be replicated elsewhere it might be possible to get to the heart of the issue.