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.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', cut_coords=None, display_mode=None, report_dims=(1600, 800))[source]

Return 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.

Parameters:
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

List[ndarray]

Contrasts information for a first or second level model.

Example:

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, default=’MNI152TEMPLATE’

See Input and output: neuroimaging data representation. The background image for mask and stat maps to be plotted on upon. To turn off background image, just pass “bg_img=None”.

thresholdfloat, default=3.09

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

alphafloat, default=0.001

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.

cluster_thresholdint, default=0

Cluster size threshold, in voxels.

height_controlstring, default=’fpr’

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

two_sidedbool, default=False

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

min_distancefloat, default=8

For display purposes only. Minimum distance between subpeaks in mm.

plot_typeString, {‘slice’, ‘glass’}, default=’slice’

Specifies the type of plot to be drawn for the statistical maps.

cut_coordsNone, a tuple of float, or int, optional

The MNI coordinates of the point where the cut is performed.

  • If display_mode is ‘ortho’ or ‘tiled’, this should be a 3-tuple: (x, y, z)

  • For display_mode == “x”, “y”, or “z”, then these are the coordinates of each cut in the corresponding direction.

  • If None is given, the cuts are calculated automatically.

  • If display_mode is ‘mosaic’, and the number of cuts is the same for all directions, cut_coords can be specified as an integer. It can also be a length 3 tuple specifying the number of cuts for every direction if these are different.

Note

If display_mode is “x”, “y” or “z”, cut_coords can be an integer, in which case it specifies the number of cuts to perform.

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], default=(1600, 800)

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.

Returns:
report_textHTMLReport Object

Contains the HTML code for the GLM Report.

Examples

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

Examples using nilearn.reporting.make_glm_report

Decoding of a dataset after GLM fit for signal extraction

Decoding of a dataset after GLM fit for signal extraction

Default Mode Network extraction of ADHD dataset

Default Mode Network extraction of ADHD dataset

First level analysis of a complete BIDS dataset from openneuro

First level analysis of a complete BIDS dataset from openneuro

Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset