Today I added functionality to read and write segmentation information into .fif files. This is handy for distinguishing
between multiple source spaces, each corresponding to a particular subcortical volume.
For an idea of the changes needed in the MNE code, check out the latest commit to my pull request.
Below is a verification that everything worked.
In [21]:
import mne
from mne.datasets import spm_face
mne.set_log_level(False)
data_path = spm_face.data_path()
# setup the cortical surface space
src_fname = data_path + '/MEG/spm/combined-src.fif'
src = mne.setup_source_space('spm', overwrite=True)
In [22]:
# add two subcortical volumes
src = mne.source_space.add_subcortical_volumes(src, ['Left-Amygdala', 'Right-Amygdala'])
mne.write_source_spaces(src_fname, src)
In [23]:
# display volume names
src[2]['seg_name'], src[3]['seg_name']
Out[23]:
In [24]:
# read saved version of combined source space
src_read = mne.read_source_spaces(src_fname)
In [25]:
# display volume names
src_read[2]['seg_name'], src_read[3]['seg_name']
Out[25]:
No comments:
Post a Comment