Cannot manually select tracing on the plotted source space estimate (plotted stc object)

  • MNE-Python version: 0.23.4
  • operating system: MS Windows 10

Hello,

I have some trouble manually inserting traces on my plotted source space estimate.

First, when I plot my source space estimate, I get the following error in my console:

QWindowsWindow::setGeometry: Unable to set geometry 1131x1216+640+276 (frame: 1149x1261+631+240) on QWidgetWindow/"MainWindowClassWindow" on "\\.\DISPLAY1". Resulting geometry: 1131x1057+640+276 (frame: 1149x1102+631+240) margins: 9, 36, 9, 9 minimum size: 394x210 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=412,255 maxtrack=0,0) QWindowsWindow::setGeometry: Unable to set geometry 1131x1216+640+276 (frame: 1149x1261+631+240) on QWidgetWindow/"MainWindowClassWindow" on "\\.\DISPLAY1". Resulting geometry: 1131x1057+640+276 (frame: 1149x1102+631+240) margins: 9, 36, 9, 9 minimum size: 394x210 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=412,255 maxtrack=0,0)

and when I click on my plotted source space estimate to set my traces manually, I get this error:

File "C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\mne\viz\_brain\_brain.py", line 1348, in _on_button_release
    self.picked_renderer = self.plotter.iren.FindPokedRenderer(x, y)
AttributeError: 'RenderWindowInteractor' object has no attribute 'FindPokedRenderer'

I also cannot erase the automatically generated traces on my plotted source space estimate no matter how many times I click on the plot. I can only clear them by pressing ‘c’. I had no trouble placing traces on my stc plots in older versions of MNE.

Here is my code:

surfer_kwargs = dict(
    hemi='lh', subjects_dir=subjects,
    views='lateral')

brain = stc.plot(**surfer_kwargs)

Thank you!

Aqil

tagging @GuillaumeFavelier; any ideas?

Hello @aqil.izadysadr, could you please share the output of

import mne
mne.sys_info()

Thanks!

Hello @richard,

Sure! You can find the output below:

Platform:      Windows-10-10.0.19043-SP0
Python:        3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Executable:    C:\Users\Aqil\anaconda3\envs\mne\python.exe
CPU:           Intel64 Family 6 Model 158 Stepping 10, GenuineIntel: 12 cores
Memory:        15.9 GB

mne:           0.23.4
numpy:         1.20.3 {blas=mkl_rt, lapack=mkl_rt}
scipy:         1.7.1
matplotlib:    3.4.2 {backend=Qt5Agg}

sklearn:       0.24.2
numba:         Not found
nibabel:       3.2.1
nilearn:       0.8.1
dipy:          1.3.0
cupy:          Not found
pandas:        1.3.2
mayavi:        Not found
pyvista:       0.32.1 {pyvistaqt=0.5.0, OpenGL 4.5.0 NVIDIA 471.96 via NVIDIA GeForce GTX 1070/PCIe/SSE2}
vtk:           9.0.1
PyQt5:         5.12.3

Thank you!

Aqil

Hello @aqil.izadysadr,

does this issue only occur with your own data, or also with the sample dataset that MNE-Python ships with?

Hello @richard,

It occurs with my own data as well as the sample dataset from MNE-Python.

Thank you!

Aqil

Hello @aqil.izadysadr,

can you please share a fully reproducible working example that uses the sample dataset?

Hello @richard,

Of course! The code that I used for the sample is the same one that is available in this link by MNE Python.

Having been contacted by @larsoner, I was told that a revision in the _brain.py script here for _on_button_release function would resolve the issue among other suggestions, and it actually did resolve the issue and allowed me to place tracing on the plotted source space estimate! You can find the code below suggested by @larsoner:

def _on_button_release(self, vtk_picker, event):
        if self._mouse_no_mvt > 0:
            x, y = vtk_picker.GetEventPosition()
            # programmatically detect the picked renderer
            try:
                # pyvista<0.30.0
                self.picked_renderer = \
                    self.plotter.iren.FindPokedRenderer(x, y)
            except AttributeError:
                # pyvista>=0.30.0
                self.picked_renderer = \
                    self.plotter.iren.interactor.FindPokedRenderer(x, y)
            # trigger the pick
            self.plotter.picker.Pick(x, y, 0, self.picked_renderer)
        self._mouse_no_mvt = 0

I still do get the following error on my Spyder console, but I am happy with being able to place tracing on my plotted source space estimate. Here is the error that has not gone away:

Using control points [1.74975597 1.92527842 3.13917643]
C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\pyvista\core\dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead.
  warnings.warn(
C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\pyvista\core\dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead.
  warnings.warn(
 
QWindowsWindow::setGeometry: Unable to set geometry 1131x1216+640+276 (frame: 1149x1261+631+240) on QWidgetWindow/"MainWindowClassWindow" on "\\.\DISPLAY1". Resulting geometry: 1131x1057+640+276 (frame: 1149x1102+631+240) margins: 9, 36, 9, 9 minimum size: 394x210 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=412,255 maxtrack=0,0)
C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\pyvista\core\dataset.py:1192: PyvistaDeprecationWarning: Use of `point_arrays` is deprecated. Use `point_data` instead.
  warnings.warn(

The error keeps reappearing every time I click on the source space plot.

Thank you!

Those were fixed in MRG, MAINT: Deal with PyVista deprecation by larsoner · Pull Request #9698 · mne-tools/mne-python · GitHub and are available if you use the current main development version, and will be part of the release of 0.24 in the next month or so

2 Likes

Hello @larsoner ,

Thank you! I found the link very helpful!

Looking forward to the next release.

Best,
Aqil