Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.image.reorder_img

nilearn.image.reorder_img(img, resample=None, copy_header=False)[source]

Return an image with the affine diagonal (by permuting axes).

The orientation of the new image will be RAS (Right, Anterior, Superior). If it is impossible to get xyz ordering by permuting the axes, a ‘ValueError’ is raised.

Parameters:
imgNiimg-like object

See Input and output: neuroimaging data representation. Image to reorder.

resampleNone or string in {‘continuous’, ‘linear’, ‘nearest’}, optional

If resample is None (default), no resampling is performed, the axes are only permuted. Otherwise resampling is performed and ‘resample’ will be passed as the ‘interpolation’ argument into resample_img.

copy_headerbool, default=None

Whether to copy the header of the input image to the output.

Added in version 0.11.0.

This parameter will be set to True by default in 0.13.0.