Using nilearn.image.reorder

What’s the use of nilearn.image.reorder_img ?
Can anyone explain in detail.

The function returns an image with a diagonal affine, meaning that the first array dimension of the image data corresponds to the Left/Right axis, the second dimension to the posterior/anterior axis, the third to the bottom/up axis.
Depending on the ‘resample’ argument, either the image is resampled, or the strides of the data are changed to that the data array matches the above constaint.
for instance, if the initiale affine is
[[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]], then the x/y axes are swapped to obtain the eye(4) affine.
HTH,
Bertrand

1 Like

Thank you so much for the explanation