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.

8.12.9. nilearn.glm.compute_contrast

nilearn.glm.compute_contrast(labels, regression_result, con_val, contrast_type=None)[source]

Compute the specified contrast given an estimated glm

labelsarray of shape (n_voxels,)

A map of values on voxels used to identify the corresponding model


With keys corresponding to the different labels values are RegressionResults instances corresponding to the voxels.

con_valnumpy.ndarray of shape (p) or (q, p)

Where q = number of contrast vectors and p = number of regressors.

contrast_type{None, ‘t’, ‘F’}, optional

Type of the contrast. If None, then defaults to ‘t’ for 1D con_val and ‘F’ for 2D con_val

conContrast instance,

Yields the statistics of the contrast (effects, variance, p-values)


This function is experimental. It may change in any future release of Nilearn.