mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

Evaluate whether FreeSurfer's `surfa` could replace or simplify some of our custom code

Open hoechenberger opened this issue 2 months ago • 3 comments

Surfa is a collection of Python utilities for medical image analysis and mesh-based surface processing. It provides tools that operate on 3D image arrays and triangular meshes with consideration of their representation in a world (or scanner) coordinate system. While broad in scope, surfa is developed with particular emphasis on neuroimaging applications.

  • Documentation

  • Code

  • surfa is a Python package derived from FreeSurfer. Some of its outputs and inputs directly overlap with MNE’s use of FreeSurfer I/O (meshes, surfaces, coordinate systems transformations).

  • It has built-in coordinate system awareness (scanner / RAS).

  • It's actively developed by the FreeSurfer team.

  • It uses Cython and compiled extensions for performance-critical operation (which can also be a con, I haven't checked whether they provide up-to-date binary wheels).

  • Since it provides a Python API, we don't need to piece together and call shell commands to run FS operations.

Any thoughts?

hoechenberger avatar Oct 05 '25 12:10 hoechenberger

It uses Cython and compiled extensions for performance-critical operation (which can also be a con, I haven't checked whether they provide up-to-date binary wheels).

Doesn't look like it:

Image

Would be great to switch to this if/when they provide binary wheels. I'll look in their repo and offer to set up cibuildwheel

larsoner avatar Oct 06 '25 14:10 larsoner

xref https://github.com/freesurfer/surfa/issues/64

larsoner avatar Oct 06 '25 14:10 larsoner

Thanks for looking into this, @larsoner!

hoechenberger avatar Oct 06 '25 15:10 hoechenberger