Skip to content

Function: computeSulcalDepth() ​

ts
function computeSulcalDepth(geometry, options?): Float32Array;

Defined in: utils/curvature.ts:278

Estimate sulcal depth (FreeSurfer sulc-like) from a folded surface, in mesh units (mm). Positive values are deep (sulcal fundi), negative values are superficial (gyral crowns), as in FreeSurfer; the result is median-centred.

A copy of the surface is smoothed into an envelope that flattens the folds, and depth is the displacement of each vertex from its smoothed position, measured along the envelope's outward normal. Unlike mean curvature, depth is smooth over whole sulci and gyri, which makes it the conventional underlay for inflated and flat surfaces: compute it on the folded surface and display it on the inflated one.

Smoothing is two implicit (backward Euler) graph-Laplacian steps whose total diffusion length is scale × the bounding radius, each solved by Jacobi-preconditioned conjugate gradients. The number of CG iterations grows with √V (the ratio of brain size to edge length), so the cost is about O(V^1.5), against O(V²) for explicit smoothing at a fixed physical scale. Measured under vitest on Apple silicon: ≈70 ms for fsaverage5 (10k vertices), ≈0.2 s at 41k, ≈1.7 s at 164k (fsaverage resolution) and ≈13 s at 655k. Compute it once and keep it; never per frame. The result does not depend on where the mesh sits in space, and vertices in no face are ignored (depth 0). Agreement with FreeSurfer lh.sulc on fsaverage5 is r = 0.96.

Parameters ​

geometry ​

SurfaceGeometry

A folded (white, pial or midthickness) surface with outward winding

options? ​

SulcalDepthOptions = {}

Smoothing scale and solver limits

Returns ​

Float32Array

Float32Array of depth values per vertex

Released under the MIT License.