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, optional

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

copybool, 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. Default=True.

order“F” or “C”, optional

Data ordering in output array. This function is slightly faster with Fortran ordering. Default=”F”.

clipbool, optional

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

fill_valuefloat, optional

Use a fill value for points outside of input volume. Default=0.

force_resamplebool, optional

Intended for testing, this prevents the use of a padding optimzation. Default=False.

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

Understanding parameters of the first-level model
Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset
Resample an image to a template

Resample an image to a template

Resample an image to a template