Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.reporting.HTMLReport

class nilearn.reporting.HTMLReport(head_tpl, body, head_values=None)[source]

A report written as HTML.

Methods such as save_as_html, or open_in_browser are inherited from class nilearn.plotting.html_document.HTMLDocument.

__init__(head_tpl, body, head_values=None)[source]

Construct the HTMLReport class.

Parameters:
head_tplTemplate

This is meant for display as a full page, eg writing on disk. This is the Template object used to generate the HTML head section of the report. The template should be filled with:

  • title: The title of the HTML page.

  • body: The full body of the HTML page. Provided through the body input.

bodystr

This parameter is used for embedding in the provided head_tpl template. It contains the full body of the HTML page.

head_valuesdict, default=None

Additional substitutions in head_tpl. if None is passed, defaults to {}

Note

This can be used to provide additional values with custom templates.

get_iframe(width=None, height=None)[source]

Get the document wrapped in an inline frame.

For inserting in another HTML page of for display in a Jupyter notebook.

Parameters:
widthint or None, default=None

Width of the inline frame.

heightint or None, default=None

Height of the inline frame.

Returns:
wrappedstr

Raw HTML code for the inline frame.

get_standalone()[source]

Return the plot in an HTML page.

open_in_browser(file_name=None, temp_file_lifetime='deprecated')[source]

Save the plot to a temporary HTML file and open it in a browser.

Parameters:
file_namestr or None, default=None

HTML file to use as a temporary file.

temp_file_lifetimefloat, default=30

Deprecated since version 0.10.3: The parameter is kept for backward compatibility and will be removed in a future version. It has no effect.

resize(width, height)[source]

Resize the plot displayed in a Jupyter notebook.

Parameters:
widthint

New width of the plot.

heightint

New height of the plot.

save_as_html(file_name)[source]

Save the plot in an HTML file, that can later be opened in a browser.

Parameters:
file_namestr

Path to the HTML file used for saving.

Examples using nilearn.reporting.HTMLReport

Decoding of a dataset after GLM fit for signal extraction

Decoding of a dataset after GLM fit for signal extraction

Extracting signals of a probabilistic atlas of functional regions

Extracting signals of a probabilistic atlas of functional regions

Extract signals on spheres and plot a connectome

Extract signals on spheres and plot a connectome

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

Simple example of two-runs fMRI model fitting

Simple example of two-runs fMRI model fitting

Voxel-Based Morphometry on OASIS dataset

Voxel-Based Morphometry on OASIS dataset

Simple example of NiftiMasker use

Simple example of NiftiMasker use

Extracting signals from brain regions using the NiftiLabelsMasker

Extracting signals from brain regions using the NiftiLabelsMasker

Understanding NiftiMasker and mask computation

Understanding NiftiMasker and mask computation

A short demo of the surface images & maskers

A short demo of the surface images & maskers