I have set up a volume source space (using mne.setup_volume_source_space) with discrete source locations (only 10 points) that are given through a dictionary (set with pos[‘rr’] and pos[‘nn’]). I am then visualizing said sources in the brain through mne.viz.plot_bem; however, I would like to be able to see which source space point corresponds to which value in the pos dict. Is there a way to customize how source points are labelled in plot_bem? Alternatively, would anyone have a suggestion for a better function that might take care of this?
Unfortunately, there isn’t.
Well, you could use the plotting function of the source object itself and then manually add annotations to that:
# Grab a volumetric source space
subjects_dir = mne.datasets.sample.data_path() / 'subjects'
src = mne.read_source_spaces(subjects_dir / 'sample' / 'bem' / 'volume-7mm-src.fif')
# Plot it, make sure to keep the figure handle
fig = src.plot(subjects_dir=subjects_dir)
# Generally, a source space defines more points than that are actually used as
# sources. Grab the source points that are actually used.
rr = src['rr'][src['inuse'].astype(bool)]
# Manually add three source points to the plot in different colors.
fig.plotter.add_mesh(pyvista.PolyData(rr[]), color='red', point_size=20)
fig.plotter.add_mesh(pyvista.PolyData(rr[]), color='green', point_size=20)
fig.plotter.add_mesh(pyvista.PolyData(rr[]), color='blue', point_size=20)