Hello,
I was trying to understand how forward solutions, labels, source spaces and surfaces relate and tried something really simple:
import mne
from surfer import Brain
data_path = mne.datasets.sample.data_path()
subjects_dir = data_path + '/subjects'
subject = 'fsaverage'
# read forward solution
fname_fwd = data_path + '/MEG/sample/sample_audvis-meg-oct-6-fwd.fif'
fwd = mne.read_forward_solution(fname_fwd)
src = fwd['src']
# I assume this is how I get the indices for vertices that span the left hemisphere
vertices = src[0]['vertno']
# let's say I want to take the leftmost ones
vertices = [vv for vv in vertices if src[0]['rr'][vv, 0] < -0.06]
# and create a label based on them
label = mne.Label(vertices, hemi='lh', name='leftmost', subject=subject)
# save to annot
mne.write_labels_to_annot(
[label], subject=subject, hemi='lh',
parc='leftparc', subjects_dir=subjects_dir, overwrite=True)
# create brain for plotting
brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir, alpha=0.999)
# and add from saved annot
brain.add_annotation('leftparc')
Can anyone explain why I am getting dots all over the surface instead of getting the leftmost area?
Thanks in advance,
Erkka