Skip to content

BUG: write_geometry and read_geometry don't seem to be in the same coordinate system #456

Closed
@kingjr

Description

@kingjr

As identified in mne-tools/mne-python#3281,

nibabel.freesurfer.io.write_geometry doesn't seem to write in the correct coordinate system.

Weirdly, this is visible in freeviewer, but not in the python viz functions we use in mne-python.

To reproduce the error (you have to copy/paste subjects/sample into subjects/sample_test since it modifies the files):

import os.path as op
from nibabel.freesurfer.io import read_geometry, write_geometry

 # I'm not sure where nibabel example is stored, so I'm using MNE.
from mne.datasets import sample
data_path = sample.data_path()

# The paths to freesurfer reconstructions
subjects_dir = data_path + '/subjects'
subject = 'sample_test'

fname = op.join(subjects_dir, subject, 'bem', 'inner_skull.surf')
coord, faces = read_geometry(fname)
write_geometry(fname, coord, faces)

in freeview, we now see a misalignment:

bug_write_surface

Weirdly, it doesn't appear when plotting in in python:

mne.viz.plot_bem plots as expected:

write_surface_mne

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