spectralbrain.load#
- spectralbrain.load(path, *, fmt=None)[source]#
Auto-detect format and load a neuroimaging / geometry file.
This is the recommended entry point for users who don’t want to think about file formats. The returned dict always contains a
"format"key; other keys depend on the format.- Parameters:
path (PathLike) – File to load.
fmt (GeometryFormat, optional) – Force a specific format (skip auto-detection).
- Returns:
dict – Contents vary by format. Guaranteed keys:
"format":GeometryFormat
Surface files add
"vertices"and"faces". Scalar overlays add"scalars". Annotations add"labels","ctab","names". Volumes add"data","affine".- Raises:
ValueError – Unknown format or failed auto-detection.
FileNotFoundError – Path does not exist.
- Return type:
Examples
>>> result = sb.io.load("lh.white") >>> verts, faces = result["vertices"], result["faces"]
>>> result = sb.io.load("lh.aparc.annot") >>> labels, names = result["labels"], result["names"]