1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
"""
.. _plot_montage:
Plotting sensor layouts of EEG systems
======================================
This example illustrates how to load all the EEG system montages
shipped in MNE-python, and display it on the fsaverage template subject.
""" # noqa: D205, D400
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Joan Massich <mailsik@gmail.com>
#
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
# %%
import os.path as op
import numpy as np
import mne
from mne.channels.montage import get_builtin_montages
from mne.datasets import fetch_fsaverage
from mne.viz import set_3d_title, set_3d_view
# %%
# Check all montages against a sphere
for current_montage in get_builtin_montages():
montage = mne.channels.make_standard_montage(current_montage)
info = mne.create_info(ch_names=montage.ch_names, sfreq=100.0, ch_types="eeg")
info.set_montage(montage)
sphere = mne.make_sphere_model(r0="auto", head_radius="auto", info=info)
fig = mne.viz.plot_alignment(
# Plot options
show_axes=True,
dig="fiducials",
surfaces="head",
trans=mne.Transform("head", "mri", trans=np.eye(4)), # identity
bem=sphere,
info=info,
)
set_3d_view(figure=fig, azimuth=135, elevation=80)
set_3d_title(figure=fig, title=current_montage)
# %%
# Check all montages against fsaverage
subjects_dir = op.dirname(fetch_fsaverage())
for current_montage in get_builtin_montages():
montage = mne.channels.make_standard_montage(current_montage)
# Create dummy info
info = mne.create_info(ch_names=montage.ch_names, sfreq=100.0, ch_types="eeg")
info.set_montage(montage)
fig = mne.viz.plot_alignment(
# Plot options
show_axes=True,
dig="fiducials",
surfaces="head",
mri_fiducials=True,
subject="fsaverage",
subjects_dir=subjects_dir,
info=info,
coord_frame="mri",
trans="fsaverage", # transform from head coords to fsaverage's MRI
)
set_3d_view(figure=fig, azimuth=135, elevation=80)
set_3d_title(figure=fig, title=current_montage)
|