moloney / dcmstack

DICOM to Nifti conversion with meta data preservation
Other
72 stars 51 forks source link

test failures on big endian systems #89

Open emollier opened 1 month ago

emollier commented 1 month ago

Hi,

I'm not sure how much this is of interest, but on the last dcmstack upload to Debian, our integration test kicked in and identified test failures on s390x architecture, which has the particularity of being a big endian system. A full log is available on Debian CI infrastructure, and relevant information follows:

 90s ________________________ TestGetData.test_single_slice _________________________
 90s 
 90s self = <test.test_dcmstack.TestGetData object at 0x3ff8182fa10>
 90s 
 90s     def test_single_slice(self):
 90s         stack = dcmstack.DicomStack()
 90s         stack.add_dcm(self.inputs[0])
 90s         data = stack.get_data()
 90s         assert data.shape == stack.shape
 90s >       assert sha256(data).hexdigest() == \
 90s             '15cfa107ca73810a1c97f1c1872a7a4a05808ba6147e039cef3f63fa08735f5d'
 90s E       AssertionError: assert '6cb31eefeb9e...749fd2d9ee117' == '15cfa107ca73...f63fa08735f5d'
 90s E         
 90s E         - 15cfa107ca73810a1c97f1c1872a7a4a05808ba6147e039cef3f63fa08735f5d
 90s E         + 6cb31eefeb9ee4828f9d8eb5e43a66392e6b1ad885442dcbb5f749fd2d9ee117
 90s 
 90s test/test_dcmstack.py:433: AssertionError
 90s __________________________ TestGetData.test_three_dim __________________________
 90s 
 90s self = <test.test_dcmstack.TestGetData object at 0x3ff8182fc20>
 90s 
 90s     def test_three_dim(self):
 90s         stack = dcmstack.DicomStack()
 90s         stack.add_dcm(self.inputs[0])
 90s         stack.add_dcm(self.inputs[1])
 90s         data = stack.get_data()
 90s         assert data.shape == stack.shape
 90s >       assert sha256(data).hexdigest() == \
 90s             'ab5225fdbedceeea3442b2c9387e1abcbf398c71f525e0017251849c3cfbf49c'
 90s E       AssertionError: assert '00d40c4955bd...08038fc24c4ba' == 'ab5225fdbedc...1849c3cfbf49c'
 90s E         
 90s E         - ab5225fdbedceeea3442b2c9387e1abcbf398c71f525e0017251849c3cfbf49c
 90s E         + 00d40c4955bd3a688adc460bc094b4a742a002be962db82094808038fc24c4ba
 90s 
 90s test/test_dcmstack.py:442: AssertionError
 90s __________________________ TestGetData.test_four_dim ___________________________
 90s 
 90s self = <test.test_dcmstack.TestGetData object at 0x3ff8182f7a0>
 90s 
 90s     def test_four_dim(self):
 90s         stack = dcmstack.DicomStack(time_order='EchoTime')
 90s         stack.add_dcm(self.inputs[0])
 90s         stack.add_dcm(self.inputs[1])
 90s         stack.add_dcm(self.inputs[2])
 90s         stack.add_dcm(self.inputs[3])
 90s         data = stack.get_data()
 90s         assert data.shape == stack.shape
 90s >       assert sha256(data).hexdigest() == \
 90s             'bb3639a6ece13dc9a11d65f1b09ab3ccaed63b22dcf0f96fb5d3dd8805cc7b8a'
 90s E       AssertionError: assert '06423e805ebb...762f71a9428cf' == 'bb3639a6ece1...3dd8805cc7b8a'
 90s E         
 90s E         - bb3639a6ece13dc9a11d65f1b09ab3ccaed63b22dcf0f96fb5d3dd8805cc7b8a
 90s E         + 06423e805ebb10230974106e38b0c0eb1d949ec3d561b5b3632762f71a9428cf
 90s 
 90s test/test_dcmstack.py:453: AssertionError
 90s __________________________ TestGetData.test_five_dim ___________________________
 90s 
 90s self = <test.test_dcmstack.TestGetData object at 0x3ff8182f740>
 90s 
 90s     def test_five_dim(self):
 90s         stack = dcmstack.DicomStack(vector_order='EchoTime')
 90s         stack.add_dcm(self.inputs[0])
 90s         stack.add_dcm(self.inputs[1])
 90s         stack.add_dcm(self.inputs[2])
 90s         stack.add_dcm(self.inputs[3])
 90s         data = stack.get_data()
 90s         assert data.shape == stack.shape
 90s >       assert sha256(data).hexdigest() == \
 90s             'bb3639a6ece13dc9a11d65f1b09ab3ccaed63b22dcf0f96fb5d3dd8805cc7b8a'
 90s E       AssertionError: assert '06423e805ebb...762f71a9428cf' == 'bb3639a6ece1...3dd8805cc7b8a'
 90s E         
 90s E         - bb3639a6ece13dc9a11d65f1b09ab3ccaed63b22dcf0f96fb5d3dd8805cc7b8a
 90s E         + 06423e805ebb10230974106e38b0c0eb1d949ec3d561b5b3632762f71a9428cf
 90s 
 90s test/test_dcmstack.py:464: AssertionError
 90s ________________________________ test_fsl_hack _________________________________
 90s 
 90s     def test_fsl_hack():
 90s         ds = make_dicom({'BitsStored': 14, }, 2**14 - 1)
 90s         stack = dcmstack.DicomStack()
 90s         stack.add_dcm(ds)
 90s         data = stack.get_data()
 90s >       assert np.max(data) == (2**14 - 1)
 90s E       assert -193 == ((2 ** 14) - 1)
 90s E        +  where -193 = <function max at 0x3ff849e6ef0>(array([[[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n      ... [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]],\n\n       [[-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193],\n        [-193]]], dtype=int16))
 90s E        +    where <function max at 0x3ff849e6ef0> = np.max

If big endian systems are not the target of dcmstack, I can live with it and configure our test infrastructure to exclude tests on s390x. However the amount of errors was surprizingly low in comparison to the coverage, so maybe support is manageable. I'm not comfortable enough with the codebase to tell for sure though. In doubt I thought you might want to be aware of the issue.

Have a nice day, :) Étienne.