Repository navigation
ENH: block parameter for viz plots - #10222
Conversation
|
Beautiful!!!!! 😍😍😍 |
|
Did you try it @hoechenberger ? Does it work for you? |
|
We have to use Detailsimport os
import mne
from mne.datasets import sample
data_path = sample.data_path()
sample_dir = os.path.join(data_path, 'MEG', 'sample')
subjects_dir = os.path.join(data_path, 'subjects')
fname_stc = os.path.join(sample_dir, 'sample_audvis-meg')
stc = mne.read_source_estimate(fname_stc, subject='sample')
initial_time = 0.096
mne.viz.set_3d_backend('pyvista')
brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
clim=dict(kind='value', lims=[3, 6, 9]),
size=600,
hemi='rh',
views=['lat', 'med'],
brain_kwargs=dict(block=True),
) |
|
Yes, works! |
|
Any opinion @larsoner ? |
larsoner
left a comment
There was a problem hiding this comment.
Other than my deprecation complaint and needing latest.inc entries, looks reasonable to me.
Has anyone tested if multiple block=True calls can be made (e.g., sequential stc.plot(brain_kwargs=dict(block=True)) calls)?
Co-authored-by: Eric Larson <[email protected]>
I think the first call should block so anything after should be executed when the window is closed. |
|
Agreed that should happen in theory, can you test that it works as expected? |
|
I tested the following real quick: import os
import mne
from mne.datasets import sample
data_path = sample.data_path()
sample_dir = os.path.join(data_path, 'MEG', 'sample')
subjects_dir = os.path.join(data_path, 'subjects')
fname_stc = os.path.join(sample_dir, 'sample_audvis-meg')
stc = mne.read_source_estimate(fname_stc, subject='sample')
initial_time = 0.096
mne.viz.set_3d_backend('pyvista')
brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
clim=dict(kind='value', lims=[3, 6, 9]),
size=600,
hemi='rh',
views=['lat', 'med'],
brain_kwargs=dict(block=True),
)
brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
clim=dict(kind='value', lims=[3, 6, 9]),
size=600,
hemi='rh',
views=['lat', 'med'],
brain_kwargs=dict(block=True),
)and this is what I got: output.mp4I realize now that it is NOT obvious. I actually close the windows with my shortcut 😅 they do not close by themselves |
larsoner
left a comment
There was a problem hiding this comment.
Deprecation not fully implemented or documented yet
Co-authored-by: Richard Höchenberger <[email protected]>
This reverts commit e3b8420.
larsoner
left a comment
There was a problem hiding this comment.
LGTM +1 for merge. Good to go from your end @GuillaumeFavelier ?
|
It is ready for me @larsoner |
|
Thanks @GuillaumeFavelier @hoechenberger ! |
This PR introduces the
blockparameter to start the Qt event loop and effectively hold the context.This PR is what I had in mind @hoechenberger
Related to #10221