MNE Version: 1.9.0
Operating System: Windows 11
Hi,
I’m trying to plot spheres representing specific coordinates onto an MNI brain template. I’ve already run the recon-all FreeSurfer pipeline on this brain for other purposes (like using it as a morph target).
I’ve written/copied some code to visualize the sphere, and I’ve manually double-checked the MNI coordinate in a separate MRI viewer to confirm their correct location. However, when I run my code, the spheres are incorrectly appearing on what seems to be S1 (the primary somatosensory cortex) instead of the intended MNI location (M1).
Here is my code:
import mne
import numpy as np
# Define subjects directory and subject
subjects_dir = r'C:\Users\User\Research\subjects_dir'
subject = 'mni152'
# Create brain plot
brain = mne.viz.Brain(
subject=subject,
hemi='lh',
surf='pial',
subjects_dir=subjects_dir,
background='white',
alpha=0.8,
units = "mm"
)
xyz= np.array([[-36, -20, 52]])
mri_mni_trans = mne.read_talxfm(subject, subjects_dir)
xyz_mni = apply_trans(mri_mni_trans, xyz)
brain.add_foci(
xyz_mni,
coords_as_verts=False,
scale_factor=1,
color='blue',
hemi='lh',
alpha=0.8
)
brain.show()
Could somebody explain me what part I am not understanding or if there is an obvious error in my approach or the code itself that might be causing this mislocation?
Plotting either xyz or xyz_mni seem to land on S1 instead of M1.
Any help or suggestions would be greatly appreciated!
Thanks!