quickbrain – fast brain surface plotting.
quickbrain.plotting¶
quickbrain.plotting – Python package for one-call brain surface visualisation.
plot_brain¶
plot_brain(stat_map=None, *, bg_map: 'Union[str, float, np.ndarray, None]' = 'curvature', threshold: 'float | None' = None, hemi: 'str' = 'left', view: 'str' = 'lateral', surf_type: 'str' = 'pial', res: 'Union[int, str]' = 'low', vol_to_surf_radius: 'float' = 3.0, overlay: 'str | Path | None' = 'default', overlay_linewidth: 'float' = 1.0, background: 'str' = 'white', post_blur: 'float' = 3.0, axes: 'Axes | None' = None, figure: 'Figure | None' = None, title: 'str | None' = None, colorbar: 'bool' = True, output_file: 'str | Path | None' = None, **kwargs) -> 'Figure'Plot a statistical map on the MNI152 brain surface.
Parameters¶
stat_map : array-like, path-like, or nibabel image, optional Per-vertex data, a path to a NIfTI volume, or a loaded
nibabelimage. Volumes are projected withnilearn.surface.vol_to_surf. If None, only the background (curvature) is shown.bg_map :
"curvature"| float | ndarray | None, default"curvature"Background map."curvature"uses the curvature map. A float in[0, 1]produces a uniform grey background.threshold : float or None, default None Stat-map values whose absolute value is below threshold are transparent.
hemi :
"left"or"right", default"left"view :
"lateral"or"medial", default"lateral"surf_type :
"pial"or"inflated", default"pial"Volume-to-surface projection is always done on the pial geometry.
Advanced options:¶
res :
1|10|"high"|"low", default"low"1/"high"= fine mesh;10/"low"= coarse (faster).vol_to_surf_radius : float, default 3.0
overlay :
"default", path, or None, default"default"SVG contour overlay. Looks foroverlays/{surf_type}/{side}_{view}.svgfirst, thenoverlays/{side}_{view}.svg.overlay_linewidth : float, default 1.0 Multiplier for the SVG stroke widths. Values > 1 make the contours thicker, < 1 thinner.
background :
"white"or"transparent", default"white"post_blur : float, default 3.0 Pixel-space Gaussian blur (sigma in px) applied to the brain bounding box after rendering but before the SVG overlay. Title and colorbar are never blurred. Set to 0 to disable.
axes : matplotlib
Axesor None Existing 3-D axes to draw into. The composited result replaces the axes content.figure : matplotlib
Figureor Nonetitle : str or None
colorbar : bool, default True
output_file : path-like or None
**kwargs Forwarded to
nilearn.plotting.plot_surf_stat_map. Forbidden:surf_mesh,engine,title.
Returns¶
matplotlib.figure.Figure
Example¶
from quickbrain import load_example_image, plot_brain
image = load_example_image("pain_response")
plot_brain(image, hemi="left", view="lateral", threshold=0.01)load_example_image¶
load_example_image(name: 'ExampleImage' = 'pain_response')Load a bundled example NIfTI image.
Parameters¶
name :
"pain_response"or"left_hippocampus"Example image to load.
Returns¶
nibabel.spatialimages.SpatialImage Loaded NIfTI image.
Example¶
from quickbrain import load_example_image, plot_brain
image = load_example_image("pain_response")
plot_brain(image, hemi="left", view="lateral", threshold=0.01)