Skip to content

Function: curvatureToGrayscale() ​

ts
function curvatureToGrayscale(curvature, options?): Float32Array;

Defined in: utils/curvature.ts:413

Convert curvature (or sulcal depth) values to grayscale for display, with gyri light and sulci dark: gray = brightness − clamp(curvature / smoothness, −0.5, 0.5) · contrast

Input follows the FreeSurfer convention (positive in sulci, negative on gyral crowns), as returned by computeMeanCurvature, computeSulcalDepth and FreeSurfer .curv/.sulc files. Pass invert: true for data with the opposite sign, or to reproduce the mapping of earlier releases (brightness + scaled · contrast). A small smoothness (≈0.2–0.5 on normalised input) gives a near-binary, FreeSurfer-like underlay; 1 gives a graded one.

Grey levels are display (sRGB) values.

Parameters ​

curvature ​

Float32Array

Curvature values (ideally normalized to ~[-1, 1])

options? ​

Display options

brightness? ​

number

contrast? ​

number

smoothness? ​

number

invert? ​

boolean

Returns ​

Float32Array

Grayscale values in [0, 1] range

Released under the MIT License.