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.

7.5.16. nilearn.image.resample_to_img

nilearn.image.resample_to_img(source_img, target_img, interpolation='continuous', copy=True, order='F', clip=False, fill_value=0, force_resample=False)

Resample a Niimg-like source image on a target Niimg-like image (no registration is performed: the image should already be aligned).

New in version 0.2.4.

source_img: Niimg-like object

See Image(s) to resample.

target_img: Niimg-like object

See Reference image taken for resampling.

interpolation: str, optional

Can be ‘continuous’ (default), ‘linear’, or ‘nearest’. Indicates the resample method.

copy: bool, optional

If True, guarantees that output array has no memory in common with input array. In all cases, input images are never modified by this function.

order: “F” or “C”

Data ordering in output array. This function is slightly faster with Fortran ordering.

clip: bool, optional

If False (default) no clip is preformed. If True all resampled image values above max(img) and under min(img) are clipped to min(img) and max(img)

fill_value: float, optional

Use a fill value for points outside of input volume (default 0).

force_resample: bool, optional

Intended for testing, this prevents the use of a padding optimzation

resampled: nibabel.Nifti1Image

input image, resampled to have respectively target image shape and affine as shape and affine. Examples using nilearn.image.resample_to_img