Closed umgpy closed 2 years ago
Hi from the log, I suspect a bad nifti header in your image if you can share the image, I could check ...
Hi @romainVala , Unfortunately I wouldn't be able to send the image but I could send the nifti header file. Although I am able to load the image without issue witth Nibabel along with on ITKSnap, 3DSlicer and FSLeyes. Let me know if the header alone would do. Thanks!
Hi @romainVala , Unfortunately I wouldn't be able to send the image but I could send the nifti header file. Although I am able to load the image without issue witth Nibabel along with on ITKSnap, 3DSlicer and FSLeyes. Let me know if the header alone would do. Thanks!
sizeof_hdr 348 data_type INT16 dim0 3 dim1 250 dim2 512 dim3 448 dim4 1 dim5 1 dim6 1 dim7 1 vox_units mm time_units s datatype 4 nbyper 2 bitpix 16 pixdim0 -1.000000 pixdim1 0.685547 pixdim2 0.685547 pixdim3 0.625000 pixdim4 1.000000 pixdim5 1.000000 pixdim6 1.000000 pixdim7 1.000000 vox_offset 352 cal_max 0.000000 cal_min 0.000000 scl_slope 0.078126 scl_inter -463.960938 phase_dim 0 freq_dim 0 slice_dim 0 slice_name Unknown slice_code 0 slice_start 0 slice_end 0 slice_duration 0.000000 toffset 0.000000 intent Unknown intent_code 0 intent_name intent_p1 0.000000 intent_p2 0.000000 intent_p3 0.000000 qform_name Unknown qform_code 0 qto_xyz:1 -0.685547 0.000000 -0.000000 -3.813309 qto_xyz:2 0.000000 0.685547 -0.000000 -174.814514 qto_xyz:3 0.000000 0.000000 0.625000 -292.000000 qto_xyz:4 0.000000 0.000000 0.000000 1.000000 qform_xorient Right-to-Left qform_yorient Posterior-to-Anterior qform_zorient Inferior-to-Superior sform_name Unknown sform_code 2 sto_xyz:1 -0.685547 0.000000 0.000000 -3.813309 sto_xyz:2 0.000000 0.685547 0.000000 -174.814514 sto_xyz:3 0.000000 0.000000 0.625000 -292.000000 sto_xyz:4 0.000000 0.000000 0.000000 1.000000 sform_xorient Right-to-Left sform_yorient Posterior-to-Anterior sform_zorient Inferior-to-Superior file_type NIFTI-1+ file_code 1 descrip Time=105757.678 aux_file
That is strange, your header looks fine. I do not understand why you get an error
To be sure, can you try
import SimpleITK as sitk
path='/path/to/image.nii'
reader = sitk.ImageFileReader()
reader.SetFileName(str(path))
reader.ReadImageInformation()
if you get the same error, this mean the image has something wrong,
if you do not get any error this mean dat_csv['LeftCropPath'][rowid]
gives the wrong path
This seems to be related to ITK, which doesn't seem to be able to read images with non-orthogonal axes, such as some CT scans. I suggest you raise this issue in the ITK GitHub repository.
I had the exact same ITK Error, causing it to fail to load some images (whereas nibabel was able to load all the images). In my case, I was on torchIO
version 0.18.84 and simpleITK
version 2.1.1.2.
I was able to fix it by downgrading SimpleITK to version 2.0.2 specifically.
🐛Bug
Data loader fails for some of the subjects, throwing the following error
ITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition found!
To reproduce
Tried iterating the images through the data loader
Expected behavior
Should load the image. Loading the image with nibabel has no issues. **Actual behavior**System info
Output of
python <(curl -s https://raw.githubusercontent.com/fepegar/torchio/master/print_system.py)
:Possibly related to this
https://github.com/InsightSoftwareConsortium/ITK/issues/2674
Thanks for the help! Cheers