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
The six canonical views, in the order the user reads them (2×3 grid). |
Functions
|
Render a hippocampal surface in six canonical anatomical views. |
|
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-8kmeshes, separatehipp/dentatesurfaces, 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.giior FreeSurfer geometry paths are accepted).scalars (ndarray, shape (N,), optional) – Per-vertex field (HKS, thickness, Cohen’s d, …). If
Nonethe bare geometry is rendered insurface_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.
smooth_iter (int) – Laplacian smoothing iterations (10–15 keeps anatomical detail).
surface_color (str) – Mesh colour when
scalarsisNone(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 (
formatscontrols extensions).
- 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.