nnDetection: [Bug] ITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition found! (SimpleITK >= 2.1.0)

Hello everyone,

Thanks for this great tool šŸ˜ƒ

šŸ’€ Bug

When using nndet_prep [task] --full-check command, the following error occured:

File "<nnDetection>/nndet/utils/check.py", line 213, in _full_check
	img_itk_seq = [load_sitk(cp) for cp in case_paths]
File "<nnDetection>/nndet/utils/check.py", line 213, in <listcomp>
	img_itk_seq = [load_sitk(cp) for cp in case_paths]
File "<nnDetection>/nndet/io/itk.py", line 107, in load_sitk
	return sitk.ReadImage(str(path), **kwargs)
File "<CondaEnv>/lib/python3.9/site-packages/SimpleITK/extra.py", line 346, in ReadImage
	return reader.Execute()
File "<CondaEnv>/lib/python3.9/site-packages/SimpleITK/SimpleITK.py", line 8015, in Execute
	return _SimpleITK.ImageFileReader_Execute(self)
RuntimeError: Exception thrown in SimpleITK ImageFileReader_Execute: /tmp/SimpleITK-build/ITK/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx:1980:
ITK ERROR: ITK only supports orthonormal direction cosines.  No orthonormal definition found!

This was noticed with the nnUNet framework when mixing different versions of SimpleITK an issue was raised (https://github.com/SimpleITK/SimpleITK/issues/1433).

When using SimpleITK 2.0.2, this error does not occur. This seems to be due to recent changes with ITK when handling Nifti headers (see https://github.com/InsightSoftwareConsortium/ITK/issues/2674 for further details and ongoing conversation).

I would think that freezing SimpleITK to SimpleITK < 2.1.0 would temporarily solve the issue.

Best

Environment

Environment Information:

----- PyTorch Information -----
PyTorch Version: 1.9.0
PyTorch Debug: False
PyTorch CUDA: 10.2
PyTorch Backend cudnn: 7605
PyTorch CUDA Arch List: ['sm_37', 'sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'compute_37']
PyTorch Current Device Capability: (7, 0)
PyTorch CUDA available: True

 


----- System Information -----
System NVCC: nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

 

System Arch List: None
System OMP_NUM_THREADS: 1
System CUDA_HOME is None: True
System CPU Count: 6
Python Version: 3.9.6 (default, Jul 30 2021, 16:35:19)
[GCC 7.5.0]

 


----- nnDetection Information -----
det_num_threads 12
det_data is set True
det_models is set True```

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Iā€™m actually experiencing the same issue with version 2.2.1 on Python 3.10:

Python version: 3.10.8 | packaged by conda-forge | (main, Nov 24 2022, 14:07:00) [MSC v.1916 64 bit (AMD64)]
SimpleITK version: 2.2.1

This error does not occur anymore for SimpleITK version 2.2.1 (tested with Python 3.10). I upgraded from 2.1.1.2 as I described in issue https://github.com/MIC-DKFZ/HD-BET/issues/25

This seems to be fixed when I moved from Simple ITK 2.2.0 to 2.2.1 (under Python 3.8.3). All is well.

I know this is old, but it is still a problem in simpleitk 2.2.0. After searching for a while, I realized the problem can stem from the qform_code and sform_code having different codes (qform is for using quaternion and sform is for using the affine matrix). A solution can be to play around with these and ensure that they conform with the definition of the coordinate system for your image.

A good resource to understand this better: https://brainder.org/2012/09/23/the-nifti-file-format/

Hi @alexandreroutier ,

I updated the sitk version inside the requirements file for now.

Iā€™m planning to rerun the preprocessing of the official data sets sometime in the future and will check if the latest version of sitk creates any Issues there. If it goes well I will probably unlock it / bump to the latest version again.

Best, Michael