Plotting MNI coordinates on inflated brain surface with add_foci

  • MNE version:1.1.1
  • operating system: Windows 10

Hi MNE community,
I was wondering how to convert MNI coordinates into ‘stereotaxic space’, whatever that might be, that add_foci() uses to plot spheres on the brain surface in mne.viz.Brain. I have a point in MNI coordinates, and I would like to be able to viusalize it on the mne.viz.Brain brain.
Thanks!

“stereotaxic space” here refers to XYZ coordinates, but does not specify the coordinate system.

this tutorial section demonstrates converting from “whatever the space is that works for add_foci” into MNI coordinates, so you can go the other direction by inverting that transform using scipy.linalg.inv or scipy.linalg.pinv and applying the resulting transform to your MNI point(s). There’s an example of inverting/appling transforms in this other tutorial section.

As for what coordinate system add_foci is expecting, I think (?) it will always expect “MRI surface RAS” (explained in this tutorial section)

Thank you so much for your response. I’m sorry, my original post was not detailed enough. I am aware of most of what you have said, however, whatever it is that add_foci is expecting does not seem to be MRI surface RAS, and since I only know how to go from MRI surface RAS to MNI, I cannot plot MNI coordinates on the brain. Here is a short code snippet to illustrate:

vertex_of_interest = 129079
surf = subjects_dir + '\\' +  sub + '\\' +  "surf" + '\\' + hemifield + '.white'

# Get vertex location in MRI surface RAS coordinates (option 1)
# read surface locations in MRI surface RAS space
rr = mne.read_surface(surf)[0]
vert_in_mri = rr[vertex_of_interest,:]

# Get vertex location in MNI coordinates
vert_in_mni = mne.vertex_to_mni(mne_vert,this_hemi,sub,subjects_dir=subjects_dir)

# Just to double check:
# Get vertex location in MRI surface RAS coordinates (option 2)
xfm = mne.read_talxfm(sub, subjects_dir)
xfm["trans"][:3, 3] *= 1000.0  # m->mm
mni_to_mri_trans = mne.transforms.invert_transform(xfm)
vert_in_mri2 = mne.transforms.apply_trans(mni_to_mri_trans['trans'], vert_in_mni)   
# vert_in_mri and vert_in_mri2 are identical 

# Plot inflated brain
brain = mne.viz.Brain(sub, hemifield, "inflated", subjects_dir=subjects_dir, background="w")
brain.add_annotation('parc2018yeo17_200')
brain.add_label(labelname[:-3], color='k', subdir = 'parc2018yeo17_200')
brain.add_foci(vertex_of_interest,coords_as_verts=True, hemi=hemifield, color='b')
brain.add_foci(vert_in_mri,hemi=hemifield, color='r')
brain.add_foci(vert_in_mni,hemi=hemifield, color='y')

The blue dot is in the expected location, but the other two are way off AND they are not similar to each other either.

I can also get the coordinates directly that add_foci seems to be plotting with brain.geo[hemifield].coords[vertex_of_interest,:], and they do not match the MRI surface RAS coordinates from above.