-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: new coreg gui features #10015
ENH: new coreg gui features #10015
Conversation
tell us when it's ready for review @GuillaumeFavelier |
I double-checked some examples and fixed a visual bug introduced in here. This PR is now ready for reviews @agramfort, @larsoner |
I ran:
clicked "lock" (to get out of fiducials mode), then hit "fit fiducials", then turned on transparent mode, then recorded this, which is just a few clusters of rapid Z translation clicks: Peek.2021-11-18.11-02.mp4
|
I added a lock on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? Because it is not compatible with the parameter head_resolution
(for example when the user sets --low-res-head
).
In an attempt to simplify interface and user interactions, what do you think of:
Also is it necessary to have all "Show HPI", "Show EEG" and "Show HSP", maybe only one "Show sensors" could work? |
From talking to @agramfort a bit, I'm tempted to just always scale by distance and orient the glyphs, and not make these optional.
Agreed
Sometimes it's nice to be able to make it transparent, and even to varying degrees. But I guess we could add support for this later, and stick with what you propose for now
Being able to toggle these separately can be nice. What if we show/hide based on the weight they are assigned for ICP? Zero weight = hide, non-zero weight = show? |
You need to use the high resolution head when picking fiducials, otherwise your clicks get locked to vertex locations that are some mm away from where you actually clicked. Also it's much harder to make out the correct fid locations when using the low resolution head. In other words, I think if you are in "set fiducials" mode, you should always be shown an opaque, high-res head with no sensors. Once you leave that mode, you should switch to a semi-transparent, high- or low- (depending on the option / config value they have set) res head with whatever sensors they've chosen to show |
Sure, I can look today or early next week |
|
# https://stackoverflow.com/questions/5160577/ctrl-c-doesnt-work-with-pyqt | ||
def _qt_app_exec(app): | ||
# adapted from matplotlib | ||
old_signal = signal.getsignal(signal.SIGINT) | ||
is_python_signal_handler = old_signal is not None | ||
if is_python_signal_handler: | ||
signal.signal(signal.SIGINT, signal.SIG_DFL) | ||
try: | ||
app.exec_() | ||
finally: | ||
# reset the SIGINT exception handler | ||
if is_python_signal_handler: | ||
signal.signal(signal.SIGINT, old_signal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @marsipu you'll probably be interested in this -- it makes ctrl-C
actually interrupt blocking mode. For me it actually kills the Python session, but matplotlib does the same. So I think it's okay (?)
if show: | ||
fig.show() | ||
# If block=False, a Qt-Event-Loop has to be started | ||
# somewhere else in the calling code. | ||
if block: | ||
QApplication.instance().exec() | ||
_qt_app_exec(QApplication.instance()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and here is where I used that private function it so that it would affect pyqtgraph
-based browsing
Pushed another couple of commits to:
@GuillaumeFavelier can you look and see if my changes and the code behavior make sense? Basically every |
Thank you for the great help @larsoner!
I took the time to review your commits carefully and I tested locally with
This is awesome!
I was not aware of this issue, for me, the plot was updated after each iteration 😮
Same for the jerkiness but it was maybe more difficult for me to notice.
Anyway, thank you for the explanation, I'll keep this in mind.
I have been digging to find where the call comes from and I tracked it down to #7791 (comment). Apparently, it was necessary during the migration to To be honest, we probably do not need it anymore. |
trying to unselect "show high resolution head" on my mac produces a segfault. Can someelse replicate? Just untick the box just after starting the GUI. ❯ mne coreg -s sample -d ~/mne_data/MNE-sample-data/subjects --interaction=trackball -f ~/mne_data/MNE-sample-data/MEG/sample/sample_audvis_raw.fif Current thread 0x000000010aa1cdc0 (most recent call first): |
I have the same behaviour |
you're on it?
… |
yes, trying to see what is going on suddenly with this head :) |
The crash seems related to the |
When I saw your comment about it being related to the hair growth stuff, my thought was "we should separate the update of the head geometry variable from the update of the PyVista plot", and it looks like indeed that's what you did, so I'll go ahead and fix the conflict and merge hopefully. I also noticed in @hoechenberger's PR some pyvista version comparisons we no longer need I think. |
* upstream/main: Use fixes._compare_version for version checks everywhere (mne-tools#10091) Fast annotation from mask (mne-tools#10089) fix trace offsets in butterfly mode (mne-tools#10087) fix plot_compare_evokeds topo legend axes placement (mne-tools#9927) doc: clarify ica.apply include and exclude params (mne-tools#10086) MRG: Make y a required parameter in CSP.fit_transform() (mne-tools#10084) Add scrollbar to report tag dropdown menu (mne-tools#10082)
Thanks @GuillaumeFavelier ! |
This PR adds support for the parameters
scale_by_distance
,project_eeg
,mark_inside
ofCoregistrationUI
.It's part of #8833
ToDo
head_transparency
,scale_by_distance
,mark_inside
andorient_to_surface
within the UXhead_resolution
widget not being sync'ed withfid_accurate
mark_inside
on maOSpyvista<0.32