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.

7.5.11. nilearn.image.mean_img

nilearn.image.mean_img(imgs, target_affine=None, target_shape=None, verbose=0, n_jobs=1)

Compute the mean of the images (in the time dimension of 4th dimension)

Note that if list of 4D images are given, the mean of each 4D image is computed separately, and the resulting mean is computed after.

Parameters:

imgs: Niimg-like object or iterable of Niimg-like objects

target_affine: numpy.ndarray, optional

If specified, the image is resampled corresponding to this new affine. target_affine can be a 3x3 or a 4x4 matrix

target_shape: tuple or list, optional

If specified, the image will be resized to match this new shape. len(target_shape) must be equal to 3. A target_affine has to be specified jointly with target_shape.

verbose: int, optional

Controls the amount of verbosity: higher numbers give more messages (0 means no messages).

n_jobs: integer, optional

The number of CPUs to use to do the computation. -1 means ‘all CPUs’.

Returns:

mean: nibabel.Nifti1Image

mean image

See also

nilearn.image.math_img
For more general operations on images