nireports.reportlets.utils module

Helper tools for visualization purposes.

nireports.reportlets.utils.combine_svg(svg_list, axis='vertical')[source]

Composes the input svgs into one standalone svg

nireports.reportlets.utils.compose_view(bg_svgs, fg_svgs, ref=0, out_file='report.svg')[source]

Compose svgs into one standalone svg with CSS flickering animation.

Parameters:
  • bg_svgs (list) – Full paths to input svgs for background.

  • fg_svgs (list) – Full paths to input svgs for foreground.

  • ref (int, optional) – Which panel to use as reference for sizing all panels. Default: 0

  • out_file (str, optional) – Full path to the output file. Default: “report.svg”.

Returns:

out_file

Return type:

same as input

nireports.reportlets.utils.cuts_from_bbox(mask_nii, cuts=3)[source]

Find equi-spaced cuts for presenting images.

nireports.reportlets.utils.extract_svg(display_object, dpi=300, compress='auto')[source]

Remove the preamble of the svg files generated with nilearn.

nireports.reportlets.utils.get_parula()[source]

Generate a ‘parula’ colormap.

nireports.reportlets.utils.robust_set_limits(data, plot_params, percentiles=(15, 99.8))[source]

Set (vmax, vmin) based on percentiles of the data.

nireports.reportlets.utils.svg2str(display_object, dpi=300)[source]

Serialize a nilearn display object to string.

nireports.reportlets.utils.svg_compress(image, compress='auto')[source]

Generate a blob SVG from a matplotlib figure, may perform compression.

nireports.reportlets.utils.transform_to_2d(data, max_axis)[source]

Projects 3d data cube along one axis using maximum intensity with preservation of the signs. Adapted from nilearn.