spectralbrain.viz.hipp3d#

Template-free 3D surface rendering in six canonical anatomical views.

The hippocampal renderers in spectralbrain.viz.hipp delegate to hippunfold_plot / hippomaps, which assume the bundled HippUnfold templates and therefore silently mismatch when handed a raw surface whose vertex count does not match a template — exactly the case for HippUnfold v2 ``den-8k`` meshes or separate hipp/dentate surfaces.

This module renders whatever mesh you hand it — vertex↔scalar correspondence is guaranteed by construction — in the six standard neuroanatomical views (anterior, posterior, inferior, superior, left-lateral, right-lateral). Rendering is done with vedo (offscreen VTK) and the six RGB renders are composited into a single matplotlib figure with a shared colorbar and view labels, following the HipPlots annotation conventions (view labels below each render, colorbar on the right, no text over the surface).

It is geometry-agnostic: the same engine renders a HippUnfold hippocampus, a marching-cubes mesh of an aseg ROI, or a whole cortical hemisphere.

Examples

>>> import spectralbrain as sb
>>> mesh = sb.BrainMesh(*sb.io.load_freesurfer_surface("lh.white"))
>>> fig = sb.viz.plot_hippocampus_sixview(mesh, scalars=thickness,
...                                       scalar_bar_title="Thickness (mm)")

Module Attributes

SIXVIEWS

The six canonical views, in the order the user reads them (2×3 grid).

Functions

plot_hippocampus_sixview(surface[, scalars, ...])

Render a hippocampal surface in six canonical anatomical views.

plot_surface_sixview(surface[, scalars, ...])

Six-view render for any surface (cortical hemisphere, subcortical ROI).

spectralbrain.viz.hipp3d.plot_hippocampus_sixview(surface, scalars=None, *, hemi='L', cmap=None, signed=False, clim=None, scalar_bar_title='value', title=None, views=('anterior', 'posterior', 'inferior', 'superior', 'left_lateral', 'right_lateral'), smooth_iter=10, surface_color='wheat', window=(560, 520), pad=0.05, save=None, formats=None)[source]#

Render a hippocampal surface in six canonical anatomical views.

Template-free: works directly on HippUnfold v2 den-8k meshes, separate hipp/dentate surfaces, or any (coords, faces) — vertex↔scalar correspondence is guaranteed because the scalar is rendered on the very mesh it was computed on.

Parameters:
  • surface (BrainMesh, (coords, faces), or path) – The hippocampal surface (GIFTI .surf.gii or FreeSurfer geometry paths are accepted).

  • scalars (ndarray, shape (N,), optional) – Per-vertex field (HKS, thickness, Cohen’s d, …). If None the bare geometry is rendered in surface_color.

  • hemi ({"L", "R"}) – Hemisphere label (annotation only; cameras are anatomical).

  • cmap (str, optional) – Defaults to "plasma" (unsigned) or "RdBu_r" (signed).

  • signed (bool) – Symmetric colour limits about zero (for contrasts / t-stats).

  • clim ((lo, hi), optional) – Manual colour limits; else 2nd–98th percentile.

  • scalar_bar_title (str) – Colorbar label (include units, e.g. "Thickness (mm)").

  • title (str, optional) – Figure suptitle.

  • views (tuple of str) – Subset / ordering of SIXVIEWS.

  • smooth_iter (int) – Laplacian smoothing iterations (10–15 keeps anatomical detail).

  • surface_color (str) – Mesh colour when scalars is None (named/hex; not a gray string).

  • window ((w, h)) – Per-view render size in pixels (scaled up by anti-aliasing).

  • pad (float) – Margin fraction around the fitted mesh (0 = tightest framing). The camera auto-fits the bounds per view, so no view is cropped.

  • save (path, optional) – If given, write the figure (formats controls extensions).

  • formats (list[str] | None)

Returns:

matplotlib.figure.Figure

spectralbrain.viz.hipp3d.plot_surface_sixview(surface, scalars=None, *, smooth_iter=0, surface_color='lightsteelblue', **kwargs)[source]#

Six-view render for any surface (cortical hemisphere, subcortical ROI).

Thin wrapper over plot_hippocampus_sixview() with defaults tuned for larger meshes (no subdivision; no extra smoothing). All keyword arguments are forwarded.

Returns:

matplotlib.figure.Figure

Parameters:
spectralbrain.viz.hipp3d.SIXVIEWS: tuple[str, ...] = ('anterior', 'posterior', 'inferior', 'superior', 'left_lateral', 'right_lateral')#

The six canonical views, in the order the user reads them (2×3 grid).