brain_deer.surface.meshes

Template surface geometry: loading, hemisphere pairing, VTK conversion.

Geometry is represented headlessly as SurfaceGeometry (vertices + faces as numpy arrays) so parsing and transforms are testable without VTK. Conversion to vtkPolyData is a separate, lazily-imported helper used only by the renderer.

Supported inputs: - FreeSurfer binary geometry (lh.pial etc.) via nibabel.freesurfer. - GIFTI surface (*.surf.gii) via nibabel.gifti. - FreeSurfer ASCII (*.asc) — small dependency-free parser.

Classes

SurfaceGeometry

A triangulated surface in RAS+ millimetres.

Functions

load_surface_geometry(→ SurfaceGeometry)

Load surface geometry from FreeSurfer binary, GIFTI, or ASCII.

combine_hemispheres(→ SurfaceGeometry)

Merge two hemisphere geometries into one (faces re-indexed).

to_vtk_polydata(geom)

Convert a SurfaceGeometry to vtkPolyData with normals (lazy VTK import).

Module Contents

class brain_deer.surface.meshes.SurfaceGeometry

A triangulated surface in RAS+ millimetres.

brain_deer.surface.meshes.load_surface_geometry(path: str, *, hemi: str | None = None) → SurfaceGeometry

Load surface geometry from FreeSurfer binary, GIFTI, or ASCII.

brain_deer.surface.meshes.combine_hemispheres(lh: SurfaceGeometry, rh: SurfaceGeometry) → SurfaceGeometry

Merge two hemisphere geometries into one (faces re-indexed).

brain_deer.surface.meshes.to_vtk_polydata(geom: SurfaceGeometry)

Convert a SurfaceGeometry to vtkPolyData with normals (lazy VTK import).