Skip to content

read_surface does not support FreeSurfer surface files (.pial, .orig) #133

@hasibagen

Description

@hasibagen

What is the current behavior?

When trying to load FreeSurfer surface files (.pial, .orig) using read_surface(), I get the following error:

TypeError: Unknown input type 'pial'.
However, when using .gii files converted from FreeSurfer surfaces, the function works correctly.

Please provide the steps to reproduce and if possible a minimal demo of the problem

This code works fine when using .gii files:

from brainspace.mesh.mesh_io import read_surface
from nilearn import surface

right_surf = surface.load_surf_mesh('/surf/rh.pial.3T_head.gii')
rh = read_surface('/surf/rh.pial.3T_head.gii')

p = Plot(rh, size=(400, 200), zoom=1.3)
p.add_layer(vertex_values, cbar=True, cmap='coolwarm', color_range=(-max_abs, max_abs))
p.build(figsize=(10, 8), scale=(4, 4))

However, when using FreeSurfer's native .pial file, the following code fails:

right_surf = surface.load_surf_mesh('/surf/rh.pial')
rh = read_surface('/surf/rh.pial')  
# Error occurs here

What is the expected behavior?

I expect read_surface() to support FreeSurfer's native surface files (.pial, .orig) without conversion, similar to how .gii files are handled.

Please tell us about your computing environment:
BrainSpace Version: 0.1.20
Python Version: 3.9.6 (default, Aug 18 2021, 19:38:01)
Operating System: Ubuntu 22.04
Other information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions