Warning: This document is for an old version of niworkflows. The main version is master.

niworkflows.viz.plots module

Plotting tools shared across MRIQC and FMRIPREP.

niworkflows.viz.plots.compcor_variance_plot(metadata_files, metadata_sources=None, output_file=None, varexp_thresh=(0.5, 0.7, 0.9), fig=None)[source]
Parameters
  • metadata_files (list) – List of paths to files containing component metadata. If more than one decomposition has been performed (e.g., anatomical and temporal CompCor decompositions), then all metadata files can be provided in the list. However, each metadata file should have a corresponding entry in metadata_sources.

  • metadata_sources (list or None) – List of source names (e.g., [‘aCompCor’]) for decompositions. This list should be of the same length as metadata_files.

  • output_file (str or None) – Path where the output figure should be saved. If this is not defined, then the plotting axes will be returned instead of the saved figure path.

  • varexp_thresh (tuple) – Set of variance thresholds to include in the plot (default 0.5, 0.7, 0.9).

  • fig (figure or None) – Existing figure on which to plot.

Returns

  • ax (axes) – Plotting axes. Returned only if the output_file parameter is None.

  • output_file (str) – The file where the figure is saved.

niworkflows.viz.plots.confoundplot(tseries, gs_ts, gs_dist=None, name=None, units=None, tr=None, hide_x=True, color='b', nskip=0, cutoff=None, ylims=None)[source]
niworkflows.viz.plots.confounds_correlation_plot(confounds_file, columns=None, figure=None, max_dim=20, output_file=None, reference='global_signal')[source]

Generate a bar plot with the correlation of confounds.

Parameters
  • confounds_file (str) – File containing all confound regressors to be included in the correlation plot.

  • figure (figure or None) – Existing figure on which to plot.

  • columns (list or None.) – Select a list of columns from the dataset.

  • max_dim (int) – The maximum number of regressors to be included in the output plot. Reductions (e.g., CompCor) of high-dimensional data can yield so many regressors that the correlation structure becomes obfuscated. This criterion selects the max_dim regressors that have the largest correlation magnitude with reference for inclusion in the plot.

  • output_file (str or None) – Path where the output figure should be saved. If this is not defined, then the plotting axes will be returned instead of the saved figure path.

  • reference (str) – confounds_correlation_plot prepares a bar plot of the correlations of each confound regressor with a reference column. By default, this is the global signal (so that collinearities with the global signal can readily be assessed).

Returns

  • axes and gridspec – Plotting axes and gridspec. Returned only if output_file is None.

  • output_file (str) – The file where the figure is saved.

class niworkflows.viz.plots.fMRIPlot(func_file, mask_file=None, data=None, conf_file=None, seg_file=None, tr=None, usecols=None, units=None, vlines=None, spikes_files=None)[source]

Bases: object

Generates the fMRI Summary Plot.

confounds
func_file
mask_data
plot(figure=None)[source]

Main plotter

seg_data
spikes
tr
niworkflows.viz.plots.plot_carpet(func, atlaslabels=None, detrend=True, nskip=0, size=(950, 800), subplot=None, title=None, output_file=None, legend=False, tr=None, lut=None)[source]

Plot an image representation of voxel intensities across time also know as the “carpet plot” or “Power plot”. See Jonathan Power Neuroimage 2017 Jul 1; 154:150-158.

Parameters
  • func (string) – Path to NIfTI or CIFTI BOLD image

  • atlaslabels (ndarray, optional) – A 3D array of integer labels from an atlas, resampled into img space. Required if func is a NIfTI image.

  • detrend (boolean, optional) – Detrend and standardize the data prior to plotting.

  • nskip (int, optional) – Number of volumes at the beginning of the scan marked as nonsteady state. Not used.

  • size (tuple, optional) – Size of figure.

  • subplot (matplotlib Subplot, optional) – Subplot to plot figure on.

  • title (string, optional) – The title displayed on the figure.

  • output_file (string, or None, optional) – The name of an image file to export the plot to. Valid extensions are .png, .pdf, .svg. If output_file is not None, the plot is saved to a file, and the display is closed.

  • legend (bool) – Whether to render the average functional series with atlaslabels as overlay.

  • tr (float , optional) – Specify the TR, if specified it uses this value. If left as None, # of frames is plotted instead of time.

  • lut (ndarray, optional) – Look up table for segmentations

niworkflows.viz.plots.spikesplot(ts_z, outer_gs=None, tr=None, zscored=True, spike_thresh=6.0, title='Spike plot', ax=None, cmap='viridis', hide_x=True, nskip=0)[source]

A spikes plot. Thanks to Bob Dogherty (this docstring needs be improved with proper ack)

niworkflows.viz.plots.spikesplot_cb(position, cmap='viridis', fig=None)[source]