Closed
Description
Running the test
import numpy as np
import nibabel as nib
data = np.arange(24).reshape((2,3,4))
img = nib.Nifti1Image(data, np.eye(4))
img.header.set_dim_info(1, 0, 2)
ornt = np.array([[2, 1], [0, 1], [1, 1]])
img_ornt = img.as_reoriented(ornt)
print(ornt[:,0])
print(img.shape)
print(img_ornt.shape)
print(img.header.get_dim_info())
print(img_ornt.header.get_dim_info())
we get
[2 0 1]
(2, 3, 4)
(3, 4, 2)
(1, 0, 2)
(1, 2, 0)
although (if I'm not wrong) the correct output should look like
[2 0 1]
(2, 3, 4)
(3, 4, 2)
(1, 0, 2)
(0, 2, 1)
(note the difference in the last line).
Shouldn't the following
Line 2023 in 5ab9414
be
new_dim[idx] = ornt[value, 0]
?
[In which case, it would be better to ensure that value has an integer data type; however, io_orienatation
returns a float array.]