Skip to content

Instantly share code, notes, and snippets.

@larsoner
Created December 6, 2021 18:55
Show Gist options
  • Save larsoner/4094624f6c0b46ad243dd22b104b310f to your computer and use it in GitHub Desktop.
Save larsoner/4094624f6c0b46ad243dd22b104b310f to your computer and use it in GitHub Desktop.
import os.path as op
import mne
from mne import setup_volume_source_space
# preamble
data_path = mne.datasets.sample.data_path()
info = mne.io.read_info(data_path + '/MEG/sample/sample_audvis_raw.fif')
subjects_dir = data_path + '/subjects'
# copy-pasted code snippets
subject = 'fsaverage'
volume_label = [ 'Brain-Stem','ctx-lh-superiortemporal','ctx-rh-superiortemporal' ]
aseg_fname = op.join( subjects_dir, subject, 'mri', 'aparc+aseg.mgz' )
src_vol_labs = setup_volume_source_space( subject, mri=aseg_fname, sphere=(0, 0, 0, 0.12),
volume_label=volume_label, subjects_dir=subjects_dir, sphere_units='m')
fig = mne.viz.plot_alignment(subject=subject, subjects_dir=subjects_dir, info=info,
surfaces='white', coord_frame='head', meg=True,
src=src_vol_labs, trans='fsaverage')
# set the view
mne.viz.set_3d_view(fig, azimuth=40, elevation=87, roll=30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment