wtclarke / nifti_mrs_tools

Software tools for the NIfTI-MRS data format
BSD 3-Clause "New" or "Revised" License
0 stars 4 forks source link

Tests fail when file endianness does not match host endianness #16

Open musicinmybrain opened 9 months ago

musicinmybrain commented 9 months ago

While packaging this for Fedora Linux, for which the big-endian s390x is a primary architecture, I found that the routines assume the file endianness and host endianness match. This results in six test failures:

=========================== short test summary info ============================
FAILED tests/test_nifti_mrs.py::test_nifti_mrs_save - nifti_mrs.validator.nif...
FAILED tests/test_script_mrs_tools.py::test_merge - subprocess.CalledProcessE...
FAILED tests/test_script_mrs_tools.py::test_split - subprocess.CalledProcessE...
FAILED tests/test_script_mrs_tools.py::test_reorder - subprocess.CalledProces...
FAILED tests/test_script_mrs_tools.py::test_reshape - subprocess.CalledProces...
FAILED tests/test_script_mrs_tools.py::test_conjugate - subprocess.CalledProc...
=================== 6 failed, 44 passed, 1 skipped in 1.96s ====================

I have attached the full build log.

This StackOverflow question suggests one way of detecting endianness in a NIfTI file.

I would understand if you chose not to support NIfTI files that don’t match the host endianness, but I thought I should at least report the issue.