Skip to content

Brain and source space are not aligned in the left_cerebellum_volume_source example #12495

@vferat

Description

@vferat

Description of the problem

In the left_cerebellum_volume_source example, the final display using the following freeview command:

nii_fname = 'mne_sample_lh-cerebellum-cortex.nii'
src.export_volume(nii_fname, mri_resolution=True)


from mne.utils import run_subprocess
mri_fname = subjects_dir + '/sample/mri/brain.mgz'
run_subprocess(['freeview', '-v', mri_fname, '-v',
                    '%s:colormap=lut:opacity=0.5' % aseg_fname, '-v',
                    '%s:colormap=jet:colorscale=0,2' % nii_fname,
                    '-slice', '157 75 105'])

shows non aligned brain/source space:

image

When checking the sources coord_frame:

[s['coord_frame'] for s in src]
[5 (FIFFV_COORD_MRI), 5 (FIFFV_COORD_MRI), 5 (FIFFV_COORD_MRI)]

From what is understand from the mne.SourceSpaces.export_volume documentation, , everything should be well aligned, as a trans Must be provided if source spaces are in head coordinates and include_surfaces and mri_resolution are True.

I have the same issue with my own dataset. Everything works fine (well aligned) with the following script:

fig = mne.viz.plot_alignment(
    subject=subject,
    subjects_dir=subjects_dir,
    surfaces="white",
    coord_frame="mri",
    src=src,
)

image

If the issue doesn't come from a misunderstanding from my part, I assume the error to be found in the export_volume method or in my freeview settings.

Steps to reproduce

Download and run the left_cerebellum_volume_source notebook

Link to data

No response

Expected results

The source space should be aligned with the brain (T1,brain,aseg)

Actual results

The source space are not aligned with the brain (T1,brain,aseg)

head↔MRI

Additional information

Platform Windows-10-10.0.19045-SP0
Python 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]
Executable c:\Users\victor.ferat\AppData\Local\miniconda3\envs\meg\python.exe
CPU Intel64 Family 6 Model 165 Stepping 2, GenuineIntel (12 cores)
Memory 15.6 GB

Core
├☑ mne 1.6.1 (latest release)
├☑ numpy 1.26.3 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
├☑ scipy 1.12.0
├☑ matplotlib 3.8.2 (backend=module://matplotlib_inline.backend_inline)
├☑ pooch 1.8.0
└☑ jinja2 3.1.3

Numerical (optional)
├☑ nibabel 5.2.0
└☐ unavailable sklearn, numba, nilearn, dipy, openmeeg, cupy, pandas

Visualization (optional)
├☑ pyvista 0.43.2 (OpenGL 4.5.0 - Build 30.0.101.1338 via Intel(R) UHD Graphics)
├☑ pyvistaqt 0.11.0
├☑ vtk 9.3.0
├☑ qtpy 2.4.1 (PyQt6=6.6.1)
├☑ pyqtgraph 0.13.3
├☑ mne-qt-browser 0.6.1
├☑ ipywidgets 8.1.1
└☐ unavailable ipympl, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline

I'm running freeview from a docker container as I'm using a windows platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions