plot_label_from_stc

Hello MNE experts,

I have a question for creating a Label from a functional STC file

I found the script plot_label_from_stc.py which is great!

However when I use the function mne.stc_to_label I am running into a problem

My STC file is an average and morph file and I read it via the command
mne_read_source_estimate.

I don't have the source space and I am forced to save the label as
unconnected vertices.

I try to reconnect the vertices in FreeSurfer but with no success so far..

Is there a way to overpass this problem in a way I can save my label as a
connected surface?

Thanks in advance

Elisabeth

if its fsaverage, you are morphed to for averaging

# select morph grade
src_fsaverage_fname = subjects_dir + '/fsaverage/bem/fsaverage-ico-5-src.fif'

src_fsaverage = mne.read_source_spaces(src_fsaverage_fname)

func_labels= mne.stc_to_label(stc_mean_label, src_fsaverage, smooth=True,
connected=True)[0]

Hi Sheraz,
Thanks for your quick answer
I already checked for this directory and file (+
'/fsaverage/bem/fsaverage-ico-5-src.fif')
unfortunately I do not have the directory "bem" in my Average directory
(only label/mri/surf/)
I am reanalysing some old data and I used older version of mne & FreeSurfer
(mne_ version 2.7.3 and freesurfer 4.3.0)
With the command make_average_subject --subjects <list of subjects>
Is there a way or command to create this bem directory and files?
Elisabeth

please use following commands, they are data independent, requires only
anatomical information. mne.setup_source_space is the one you need for the
src file.

conductivity = (0.3,) #MEG only
model = mne.make_bem_model(subject=subject, ico=4,
                           conductivity=conductivity,
                           subjects_dir=subjects_dir)
bem = mne.make_bem_solution(model)
src = mne.setup_source_space(subject, spacing='ico5',
                             subjects_dir=subjects_dir,
                             add_dist=False, overwrite=True)

Sheraz

Thanks you so much Sheraz!
It worked perfectly!
Best,
Elisabeth