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.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)[source]#

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.

Parameters:
source_imgNiimg-like object

See Input and output: neuroimaging data representation. Image(s) to resample.

target_imgNiimg-like object

See Input and output: neuroimaging data representation. Reference image taken for resampling.

interpolationstr, default=’continuous’

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

copybool, default=True

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”, default=”F”

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

clipbool, default=False

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

fill_valuefloat, default=0

Use a fill value for points outside of input volume.

force_resamplebool, default=False

Intended for testing, this prevents the use of a padding optimization.

Returns:
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#

Understanding parameters of the first-level model

Understanding parameters of the first-level model

Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset

Resample an image to a template

Resample an image to a template