plotting vertices/sources in the brain

I have a list of locations in an array (of the shape array([[-56.452962, -47.393728, 3.289199], etc) that Iā€™m trying to plot on a 3D brain using mne.viz.Brain.

The code is as follows:

from mne.datasets import fetch_fsaverage
import os.path
fs_dir = fetch_fsaverage(verbose=True)
subjects_dir = os.path.dirname(fs_dir)
subject = 'fsaverage'
import mne
mne.viz.set_3d_backend("pyvista")
subjects_dir = mne.datasets.sample.data_path() + '/subjects'
Brain = mne.viz.get_brain_class()
brain = Brain('sample', hemi='both', surf='pial',cortex='classic',
              subjects_dir=subjects_dir, alpha = 0.2, size=(800, 600))
brain.add_foci(data, hemi='rh',color='blue')

I have two questions:

  1. Iā€™m not sure what coordinate space my data is in and judging by the plots, it might be wrong but Iā€™m not sure how to adjust it.
  2. the ā€œdataā€ array has locations in both hemispheres, but I can only add the foci if I specify left or right, why canā€™t I specify ā€œbothā€ hemispheres?

Hello @vss245 and welcome to the forum!

I donā€™t understand the question. To convert your data into a different coordinate system, you will have to apply some sort of transformation. Without knowing the source coordinate system, thereā€™s no way to know if and which transform to apply.

I believe this is a limitation inherited from FreeSurfer, which treats the hemispheres separately.


Have you had a look at the Label class? I believe this could be what you need.

hi Richard, thanks for the answers. I assumed that MNE might account for some standard coordinate spaces (e.g. MNI, Talaraich) that I can explicitly set when plotting, but I will try to find out the coordinate system of my data by cross-checking it against atlases or something like that. thanks for the answer on the hemispheres point and I will try the Label class!

MNE-Python internally stores everything in SI units, which for source locations means the units are meters. The coordinate frame is usually ā€œheadā€ which is a Right-Anterior-Superior frame defined by the cardinal anatomical points (nasion, left- and right-preauricular points). Much more info can be found here:

https://mne.tools/stable/auto_tutorials/forward/20_source_alignment.html

2 Likes