Here is my code for forward solution:
src = mne.setup_source_space(subject, spacing='all', add_dist='patch',
subjects_dir=subjects_dir)
print(src)
import os.path as op
#https://mne.tools/stable/auto_tutorials/forward/30_forward.html
surface = op.join(subjects_dir, subject, 'bem', 'inner_skull.surf')
vol_src = mne.setup_volume_source_space(subject, subjects_dir=subjects_dir,
surface=surface)
print(vol_src)
model = mne.make_bem_model(subject='SV', ico=4,
conductivity=conductivity,
subjects_dir=subjects_dir)
bem = mne.make_bem_solution(model)
fwd = mne.make_forward_solution(info, trans=trans, src=src, bem=bem,
meg=True, eeg=False, mindist=5.0, n_jobs=1,
verbose=True, ignore_ref=True)
print(fwd)
And here are the results of “forward_solution”:
Source space : <SourceSpaces: [<surface (lh), n_vertices=142069, n_used=258>, <surface (rh), n_vertices=145134, n_used=258>] MRI (surface RAS) coords, subject ‘SV’, ~26.4 MB>
MRI → head transform : /Users/shirinvafaei/Documents/Datasets/sentences_word_by_word/MEG_raw/Shirin_20201021/train0_20201021-trans.fif
Measurement data : instance of Info
Conductor model : instance of ConductorModel
Accurate field computations
Do computations in head coordinates
Free source orientations
Read 2 source spaces a total of 516 active source locations
Coordinate transformation: MRI (surface RAS) → head
0.995143 -0.095295 0.024692 -4.36 mm
0.086552 0.966476 0.241728 11.86 mm
-0.046900 -0.238417 0.970030 20.61 mm
0.000000 0.000000 0.000000 1.00
Read 160 MEG channels from info
99 coil definitions read
Coordinate transformation: MEG device → head
-1.000000 -0.000000 0.000000 0.14 mm
0.000000 -1.000000 0.000000 57.11 mm
0.000000 0.000000 1.000000 15.90 mm
0.000000 0.000000 0.000000 1.00
MEG coil definitions created in head coordinates.
Source spaces are now in head coordinates.
Employing the head->MRI coordinate transform with the BEM model.
BEM model instance of ConductorModel is now set up
Source spaces are in head coordinates.
Checking that the sources are inside the surface and at least 5.0 mm away (will take a few…)
Skipping interior check for 113 sources that fit inside a sphere of radius 53.9 mm
Skipping solid angle check for 0 points using Qhull
Skipping interior check for 110 sources that fit inside a sphere of radius 53.9 mm
Skipping solid angle check for 0 points using Qhull
Setting up compensation data…
No compensation set. Nothing more to do.
Composing the field computation matrix…
Computing MEG at 516 source locations (free orientations)…
Finished.
<Forward | MEG channels: 160 | EEG channels: 0 | Source space: Surface with 516 vertices | Source orientation: Free>
However, in this tutorialhttps://mne.tools/dev/auto_tutorials/inverse/10_stc_class.html (as an example), the number of vertices is arund 7498.
The main reason that I am asking this is when I wan to get the source estimated data related to the labels of various brain regions (obtained from hcp parcellation), I receive this error:
ValueError Traceback (most recent call last)
in
3
4 for stc_data in stcs:
----> 5 stc_label = stc_data.in_label(lbl)
6
~/opt/anaconda3/lib/python3.7/site-packages/mne/source_estimate.py in in_label(self, label)
1405
1406 if sum([len(v) for v in vertices]) == 0:
→ 1407 raise ValueError(‘No vertices match the label in the stc file’)
1408
1409 label_stc = self.class(values, vertices=vertices, tmin=self.tmin,
ValueError: No vertices match the label in the stc file
Here is my code for the later part:
#using HCP parcellation
labels_parc = mne.read_labels_from_annot(subject, parc='HCPMMP1',
subjects_dir=fs_dir_local)
for lbl in labels_parc:
lbl_name = lbl.name
for stc_data in stcs:
stc_label = stc_data.in_label(lbl)
stcs are a list of source estimated data. Length of stcs is equal to number of epochs and each element has the shape (516, 551), which I think can be interpolated as 516 vertices and 551 time points.
However, I have difficulty when want to extract the data for each brain region using the HCP parcellation.
I sincerely appreciate your help.
Shirin