SpectralBrain#

SpectralBrain

Spectral shape analysis for brain structures

Compute, analyze, and visualize intrinsic spectral shape descriptors of cortical surfaces, subcortical and hippocampal meshes, white-matter tracts, and point clouds — from the Laplace–Beltrami operator straight through to rigorous statistics and publication-ready figures.

Install#
pip install spectralbrain

A five-line taste — the Heat Kernel Signature of a surface:

import spectralbrain as sb

vertices, faces = sb.load_freesurfer_surface("lh.pial")
mesh = sb.BrainMesh(vertices, faces)
decomp = mesh.decompose(k=300)                 # Laplace–Beltrami eigenpairs
hks = sb.compute_hks(decomp, t_values=[1, 10, 100])
sb.plot_brain(data=hks[:, 0], atlas="schaefer_400")

Where to go next#

Getting Started

Install, run your first analysis, and find the learning path that matches what you already know.

Getting Started
Learn

The why behind the methods — one page per descriptor family, the distances, and normative modeling.

Learn
Tutorials

Ten end-to-end notebooks, from the Laplace–Beltrami operator to Bayesian models on real cohorts.

Tutorials
Example Gallery

Short, runnable recipes — each one is a figure you can reproduce in seconds.

Example Gallery
How-to Guides

Task-focused recipes: the GPU backend, multi-site harmonization, vertex-wise statistics, the MTLE-HS hippocampus workflow.

How-to guides
API Reference

Every public class and function, generated from the source docstrings.

API Reference

Why spectral shape?#

Volume and thickness collapse a structure’s shape to a few scalars and are sensitive to registration and voxel size. Intrinsic spectral descriptors derived from the Laplace–Beltrami operator characterize shape independently of pose and parameterization, capturing geometry that volume alone misses. SpectralBrain packages those descriptors together with the I/O, multi-site harmonization, correct multiple-comparison statistics, and rendering that a neuroimaging study needs end to end — with a primary focus on the hippocampus in mesial temporal lobe epilepsy, while staying general to any brain surface or point cloud.