From 8019521e57a355e0eda14c8fb1396575c647d26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Fa=C3=9Fnacht?= <152301919+smonfas@users.noreply.github.com> Date: Thu, 8 Jan 2026 15:33:24 +0100 Subject: [PATCH] Add support for loading GIFTI surface files --- library/voxeldepths_from_surfaces.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/library/voxeldepths_from_surfaces.py b/library/voxeldepths_from_surfaces.py index 202bf17..ea8678d 100755 --- a/library/voxeldepths_from_surfaces.py +++ b/library/voxeldepths_from_surfaces.py @@ -21,9 +21,17 @@ def load_fs_surf_in_grid(surf_file, grid_to_scanner, label_file=None): by using the grid_to_scanner transformation (e.g. affine function a functional nifti image). """ # load freesurfer surface - coords, faces, volume_info = nib.freesurfer.read_geometry( - surf_file, read_metadata=True - ) + fs_to_scanner = np.eye(4) + if surf_file[-4:] == ".gii": + surf_gii = nib.load(surf_file) + coords = surf_gii.agg_data("NIFTI_INTENT_POINTSET") + faces = surf_gii.agg_data("NIFTI_INTENT_TRIANGLE") + volume_info = {"cras": np.array([0.0, 0.0, 0.0])} + else: + # load freesurfer surface + coords, faces, volume_info = nib.freesurfer.read_geometry( + surf_file, read_metadata=True + ) # if label file provided if label_file is not None: