Skip to content

non-interactive brain figure #12276

@drammock

Description

@drammock

Description of the problem

brain windows are not interactable, don't respond to their close buttons, and crash sometimes when calling brain.close()

Steps to reproduce

import mne

data_path = mne.datasets.sample.data_path()
subjects_dir = data_path / "subjects"
sample_dir = data_path / "MEG" / "sample"
brain_kwargs = dict(alpha=0.1, background="white", cortex="low_contrast")
brain = mne.viz.Brain("sample", subjects_dir=subjects_dir, **brain_kwargs)

Link to data

No response

Expected results

an interactive window.

Actual results

a non-interactable window showing a brain that is zoomed in to the level where it shows about 3 gyri. Closing the window manually doesn't work ("the program isn't responding, wait or terminate?"). Calling brain.close() works sometimes, other times it yields this:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:574, in QVTKRenderWindowInteractor.mousePressEvent(self, ev)
    571 self._ActiveButton = ev.button()
    573 if self._ActiveButton == MouseButton.LeftButton:
--> 574     self._Iren.LeftButtonPressEvent()
    575 elif self._ActiveButton == MouseButton.RightButton:
    576     self._Iren.RightButtonPressEvent()

AttributeError: '_FakeIren' object has no attribute 'LeftButtonPressEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:587, in QVTKRenderWindowInteractor.mouseReleaseEvent(self, ev)
    583 self._setEventInformation(pos_x, pos_y,
    584                           ctrl, shift, chr(0), 0, None)
    586 if self._ActiveButton == MouseButton.LeftButton:
--> 587     self._Iren.LeftButtonReleaseEvent()
    588 elif self._ActiveButton == MouseButton.RightButton:
    589     self._Iren.RightButtonReleaseEvent()

AttributeError: '_FakeIren' object has no attribute 'LeftButtonReleaseEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:574, in QVTKRenderWindowInteractor.mousePressEvent(self, ev)
    571 self._ActiveButton = ev.button()
    573 if self._ActiveButton == MouseButton.LeftButton:
--> 574     self._Iren.LeftButtonPressEvent()
    575 elif self._ActiveButton == MouseButton.RightButton:
    576     self._Iren.RightButtonPressEvent()

AttributeError: '_FakeIren' object has no attribute 'LeftButtonPressEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:587, in QVTKRenderWindowInteractor.mouseReleaseEvent(self, ev)
    583 self._setEventInformation(pos_x, pos_y,
    584                           ctrl, shift, chr(0), 0, None)
    586 if self._ActiveButton == MouseButton.LeftButton:
--> 587     self._Iren.LeftButtonReleaseEvent()
    588 elif self._ActiveButton == MouseButton.RightButton:
    589     self._Iren.RightButtonReleaseEvent()

AttributeError: '_FakeIren' object has no attribute 'LeftButtonReleaseEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:576, in QVTKRenderWindowInteractor.mousePressEvent(self, ev)
    574     self._Iren.LeftButtonPressEvent()
    575 elif self._ActiveButton == MouseButton.RightButton:
--> 576     self._Iren.RightButtonPressEvent()
    577 elif self._ActiveButton == MiddleButton:
    578     self._Iren.MiddleButtonPressEvent()

AttributeError: '_FakeIren' object has no attribute 'RightButtonPressEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:589, in QVTKRenderWindowInteractor.mouseReleaseEvent(self, ev)
    587     self._Iren.LeftButtonReleaseEvent()
    588 elif self._ActiveButton == MouseButton.RightButton:
--> 589     self._Iren.RightButtonReleaseEvent()
    590 elif self._ActiveButton == MiddleButton:
    591     self._Iren.MiddleButtonReleaseEvent()

AttributeError: '_FakeIren' object has no attribute 'RightButtonReleaseEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:574, in QVTKRenderWindowInteractor.mousePressEvent(self, ev)
    571 self._ActiveButton = ev.button()
    573 if self._ActiveButton == MouseButton.LeftButton:
--> 574     self._Iren.LeftButtonPressEvent()
    575 elif self._ActiveButton == MouseButton.RightButton:
    576     self._Iren.RightButtonPressEvent()

AttributeError: '_FakeIren' object has no attribute 'LeftButtonPressEvent'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/mambaforge/envs/mnedev/lib/python3.11/site-packages/pyvistaqt/rwi.py:587, in QVTKRenderWindowInteractor.mouseReleaseEvent(self, ev)
    583 self._setEventInformation(pos_x, pos_y,
    584                           ctrl, shift, chr(0), 0, None)
    586 if self._ActiveButton == MouseButton.LeftButton:
--> 587     self._Iren.LeftButtonReleaseEvent()
    588 elif self._ActiveButton == MouseButton.RightButton:
    589     self._Iren.RightButtonReleaseEvent()

AttributeError: '_FakeIren' object has no attribute 'LeftButtonReleaseEvent'
I

Additional information

Platform             Linux-5.15.0-58-generic-x86_64-with-glibc2.35
Python               3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0]
Executable           /opt/mambaforge/envs/mnedev/bin/python3.11
CPU                  x86_64 (16 cores)
Memory               125.7 GB

Core
├☑ mne               1.7.0.dev29+g4ff2ca41f (devel, latest release is 1.6.0)
├☑ numpy             1.26.0 (OpenBLAS 0.3.24 with 16 threads)
├☑ scipy             1.11.3
├☑ matplotlib        3.8.1 (backend=QtAgg)
├☑ pooch             1.8.0
└☑ jinja2            3.1.2

Numerical (optional)
├☑ sklearn           1.3.2
├☑ numba             0.58.1
├☑ nibabel           5.1.0
├☑ nilearn           0.10.2
├☑ dipy              1.7.0
├☑ openmeeg          2.5.6
├☑ cupy              12.2.0
└☑ pandas            2.1.3

Visualization (optional)
├☑ pyvista           0.42.3 (OpenGL 4.5.0 NVIDIA 470.223.02 via NVIDIA GeForce RTX 2060/PCIe/SSE2)
├☑ pyvistaqt         0.0.0
├☑ vtk               9.2.6
├☑ qtpy              2.4.1 (PyQt5=5.15.8)
├☑ ipympl            0.9.3
├☑ pyqtgraph         0.13.3
├☑ mne-qt-browser    0.7.0.dev2+g2e26973
├☑ ipywidgets        8.1.1
├☑ trame_client      2.12.6
├☑ trame_server      2.12.1
├☑ trame_vtk         2.6.0
└☑ trame_vuetify     2.3.1

Ecosystem (optional)
├☑ mne-bids          0.14.dev0
├☑ mne-nirs          0.6.0
├☑ mne-connectivity  0.6.0dev0
├☑ mne-bids-pipeline 1.5.0.dev42+g1705142
└☐ unavailable       mne-features, mne-icalabel

Notice that pyvistaqt is marked as version 0.0.0. However:

$ mamba list pyvistaqt
# packages in environment at /opt/mambaforge/envs/mnedev:
#
# Name                    Version                   Build  Channel
pyvistaqt                 0.11.0             pyhd8ed1ab_0    conda-forge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions