wasserth / TotalSegmentator

Tool for robust segmentation of >100 important anatomical structures in CT and MR images
Apache License 2.0
1.42k stars 239 forks source link

Index out of range #197

Closed emilyewesel closed 7 months ago

emilyewesel commented 11 months ago

Hi! When I run ! TotalSegmentator -i patient2/ -o segmentations

I get the following error:

Traceback (most recent call last): File "/usr/local/bin/TotalSegmentator", line 8, in sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/totalsegmentator/bin/TotalSegmentator.py", line 127, in main totalsegmentator(args.input, args.output, args.ml, args.nr_thr_resamp, args.nr_thr_saving, File "/usr/local/lib/python3.10/dist-packages/totalsegmentator/python_api.py", line 260, in totalsegmentator organseg, = nnUNet_predict_image(input, None, 298, model="3d_fullres", folds=[0], File "/usr/local/lib/python3.10/dist-packages/totalsegmentator/nnunet.py", line 266, in nnUNet_predict_image dcm_to_nifti(file_in, tmp_dir / "dcm" / "converted_dcm.nii.gz", verbose=verbose) File "/usr/local/lib/python3.10/dist-packages/totalsegmentator/dicom_io.py", line 121, in dcm_to_nifti dicom2nifti.dicom_series_to_nifti(input_path, output_path, reorient_nifti=True) File "/usr/local/lib/python3.10/dist-packages/dicom2nifti/convert_dicom.py", line 77, in dicom_series_to_nifti return dicom_array_to_nifti(dicom_input, output_file, reorient_nifti) File "/usr/local/lib/python3.10/dist-packages/dicom2nifti/convert_dicom.py", line 111, in dicom_array_to_nifti if not are_imaging_dicoms(dicom_list): File "/usr/local/lib/python3.10/dist-packages/dicom2nifti/convert_dicom.py", line 150, in are_imaging_dicoms if common.is_multiframe_dicom(dicom_input): File "/usr/local/lib/python3.10/dist-packages/dicom2nifti/common.py", line 148, in is_multiframe_dicom header = dicom_input[0] IndexError: list index out of range

wasserth commented 11 months ago

Somehow the dicom to nifti conversion fails. The input folder is only allowed to contain the slices of one volume. It this the case? Does it work with other images?

kateduquesne commented 11 months ago

Hi

I had the same issue before. I had some conflicting libraries. This problem seemed to be solved by installing the newest version of nibabel and omitting the nibabel install from the setup.py. Not sure why this occurred. However, then an other error later occured (see issue #198).