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.13.2. nilearn.reporting.make_glm_report

nilearn.reporting.make_glm_report(model, contrasts, title=None, bg_img='MNI152TEMPLATE', threshold=3.09, alpha=0.001, cluster_threshold=0, height_control='fpr', two_sided=False, min_distance=8.0, plot_type='slice', display_mode=None, report_dims=(1600, 800))[source]

Returns HTMLReport object for a report which shows all important aspects of a fitted GLM. The object can be opened in a browser, displayed in a notebook, or saved to disk as a standalone HTML file.

modelFirstLevelModel or SecondLevelModel object

A fitted first or second level model object. Must have the computed design matrix(ces).

contrastsDict[string, ndarray] or String or List[String] or ndarray or


Contrasts information for a first or second level model.


Dict of contrast names and coefficients, or list of contrast names or list of contrast coefficients or contrast name or contrast coefficient

Each contrast name must be a string. Each contrast coefficient must be a list or numpy array of ints.

Contrasts are passed to contrast_def for FirstLevelModel (nilearn.glm.first_level.FirstLevelModel.compute_contrast) & second_level_contrast for SecondLevelModel (nilearn.glm.second_level.SecondLevelModel.compute_contrast)

titleString, optional

If string, represents the web page’s title and primary heading, model type is sub-heading. If None, page titles and headings are autogenerated using contrast names.

bg_imgNiimg-like object, optional

See The background image for mask and stat maps to be plotted on upon. To turn off background image, just pass “bg_img=None”. Default=’MNI152TEMPLATE’.

thresholdfloat, optional

Cluster forming threshold in same scale as stat_img (either a t-scale or z-scale value). Used only if height_control is None. Default=3.09.

alphafloat, optional

Number controlling the thresholding (either a p-value or q-value). Its actual meaning depends on the height_control parameter. This function translates alpha to a z-scale threshold. Default=0.001.

cluster_thresholdint, optional

Cluster size threshold, in voxels. Default=0.

height_controlstring, optional

false positive control meaning of cluster forming threshold: ‘fpr’ (default) or ‘fdr’ or ‘bonferroni’ or None. Default=’fpr’.

two_sidedbool, optional

Whether to employ two-sided thresholding or to evaluate positive values only. Default=False.

min_distancefloat, optional

For display purposes only. Minimum distance between subpeaks in mm. Default=8mm.

plot_typeString, {‘slice’, ‘glass’}, optional

Specifies the type of plot to be drawn for the statistical maps. Default=’slice’.

display_modestring, optional

Default is ‘z’ if plot_type is ‘slice’; ‘ ortho’ if plot_type is ‘glass’.

Choose the direction of the cuts: ‘x’ - sagittal, ‘y’ - coronal, ‘z’ - axial, ‘l’ - sagittal left hemisphere only, ‘r’ - sagittal right hemisphere only, ‘ortho’ - three cuts are performed in orthogonal directions.

Possible values are: ‘ortho’, ‘x’, ‘y’, ‘z’, ‘xz’, ‘yx’, ‘yz’, ‘l’, ‘r’, ‘lr’, ‘lzr’, ‘lyr’, ‘lzry’, ‘lyrz’.

report_dimsSequence[int, int], optional

Specifies width, height (in pixels) of report window within a notebook. Only applicable when inserting the report into a Jupyter notebook. Can be set after report creation using report.width, report.height. Default is (1600, 800) pixels.

report_textHTMLReport Object

Contains the HTML code for the GLM Report.


report = make_glm_report(model, contrasts) report.open_in_browser() report.save_as_html(destination_path)