Hello everybody,
I am trying to perform source localization following the instructions from @richard 's youtube video on MEG analysis. In the course of this, I am experiencing issues when trying to perform the coregistration. To be specific, the coregistration GUI did not open intially, when I just typed:
mne.gui.coregistration(subject=subject, subjects_dir=subjects_dir, inst=epochs_path)
I got the following error message:
mne.gui.coregistration(subject=subject, subjects_dir=subjects_dir, inst=epochs_path)
Using pyvistaqt 3d backend.
qt.qpa.xcb: X server does not support XInput 2
qt.qpa.xcb: QXcbConnection: XCB error: 1 (BadRequest), sequence: 169, resource id: 132, major code: 130 (Unknown), minor code: 47
qt.qpa.gl: QXcbConnection: Failed to initialize GLX
ERROR:root:Cannot activate multiple GUI eventloops
ERROR:root:1:
2023-01-12 11:09:37.410 ( 7,073s) [ 3A154740] vtkShaderProgram.cxx:452 ERR| vtkShaderProgram (0x56057974e570): 1:
2: #version 140
3: #ifdef GL_ES
4: #ifdef GL_FRAGMENT_PRECISION_HIGH
5: precision highp float;
6: precision highp sampler2D;
7: precision highp sampler3D;
8: #else
9: precision mediump float;
10: precision mediump sampler2D;
11: precision mediump sampler3D;
12: #endif
13: #define texelFetchBuffer texelFetch
14: #define texture1D texture
15: #define texture2D texture
16: #define texture3D texture
17: #else // GL_ES
18: #define highp
19: #define mediump
20: #define lowp
21: #if __VERSION__ == 150
22: #define texelFetchBuffer texelFetch
23: #define texture1D texture
24: #define texture2D texture
25: #define texture3D texture
26: #endif
27: #endif // GL_ES
28: #define varying in
29:
30: in vec2 texCoord;
31: uniform sampler2DMS tex;
32: uniform int samplecount;
33: out vec4 fragOutput0;
34:
35:
36: void main()
37: {
38: float gamma = 2.2;
39:
40: // foERROR:root:error: syntax error, unexpected NEW_IDENTIFIER, expecting '{'
r each sample in the multi sample buffer...
41: ivec2 itexcoords = ivec2(floor(textureSize(tex) * texCoord));
42: vec3 accumulate = vec3(0.0,0.0,0.0);
43: float alpha = 0.0;
44:
45: for (int i = 0; i < samplecount; i++)
46: {
47: vec4 sample = texelFetch(tex, itexcoords, i);
48: // apply gamma correction and sum
49: accumulate += pow(sample.rgb, vec3(gamma));
50: alpha += sample.a;
51: }
52:
53: // divide and reverse gamma correction
54: accumulate /= float(samplecount);
55: fragOutput0 = vec4(pow(accumulate, vec3(1.0/gamma)), alpha/float(samplecount));
56: }
57:
ERROR:root:attempt to add attribute without a program for attribute ndCoordIn
2023-01-12 11:09:37.411 ( 7,075s) [ 3A154740] vtkShaderProgram.cxx:453 ERR| vtkShaderProgram (0x56057974e570): 0:31(22): error: syntax error, unexpected NEW_IDENTIFIER, expecting '{'
2023-01-12 11:09:37.412 ( 7,075s) [ 3A154740]vtkOpenGLVertexArrayObj:265 ERR| vtkOpenGLVertexArrayObject (0x56057a6ad2a0): attempt to add attribute without a program for attribute ndCoordIn
ERROR:root:Couldn't build the shader program for resolving msaa.
2023-01-12 11:09:37.412 ( 7,076s) [ 3A154740]vtkOpenGLQuadHelper.cxx:70 WARN| Error binding ndCoords to VAO.
2023-01-12 11:09:37.412 ( 7,076s) [ 3A154740]vtkOpenGLRenderWindow.c:1099 ERR| vtkXOpenGLRenderWindow (0x5605797edc80): Couldn't build the shader program for resolving msaa.
ERROR:root:Could not find a decent config
2023-01-12 11:09:37.494 ( 7,157s) [ 3A154740]vtkXOpenGLRenderWindow.:266 ERR| vtkXOpenGLRenderWindow (0x5605797e9480): Could not find a decent config
/home/pascal/anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh: line 18: 2869232 Aborted (core dumped) $CONDA_ENV_PYTHON -m spyder_kernels.console -f $SPYDER_KERNEL_SPEC
Fatal Python error: Aborted
Main thread:
Current thread 0x00007f243a154740 (most recent call first):
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/pyvista/utilities/helpers.py", line 1245 in check_depth_peeling
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/pyvista/plotting/renderer.py", line 431 in enable_depth_peeling
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/mne/viz/backends/_pyvista.py", line 708 in _enable_depth_peeling
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/mne/viz/backends/_pyvista.py", line 230 in __init__
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/mne/viz/backends/_qt.py", line 1626 in __init__
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/mne/viz/backends/renderer.py", line 44 in _get_renderer
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/mne/gui/_coreg.py", line 222 in __init__
File "<decorator-gen-603>", line 12 in __init__
File "/home/pascal/anaconda3/envs/mne/lib/python3.10/site-packages/mne/gui/__init__.py", line 193 in coregistration
File "<decorator-gen-591>", line 12 in coregistration
File "/tmp/ipykernel_2869232/782840189.py", line 1 in <cell line: 1>
Restarting kernel...
… and the kernel restarts automatically.
After looking at a related thread (MNE Coreg Segmentation Fault - #10 by AlessandraDV), I changed the code to:
mne.viz.set_3d_options(antialias=False, depth_peeling=False, smooth_shading=False)
mne.gui.coregistration(subject=subject, subjects_dir=subjects_dir, inst=epochs_path, advanced_rendering=False)
Now, a PyVista scene opens, but freezes immediately, and all I can do is force-close it.
Before it opens opens up and freezes, the output is again:
Using pyvistaqt 3d backend.
/home/pascal/media/disk/_cygdrive_C_Users_pasca_ONEDRI1_DOKUME2_Helsinki_Daten/Code/source_localization.py:50: RuntimeWarning: The parameter advanced_rendering is not supported with the pyvistaqt 3d backend. It will be ignored.
mne.gui.coregistration(subject=subject, subjects_dir=subjects_dir, inst=epochs_path, advanced_rendering=False)
ERROR:root:Cannot activate multiple GUI eventloops
ERROR:root:1:
ERROR:root:error: syntax error, unexpected NEW_IDENTIFIER, expecting '{'
ERROR:root:attempt to add attribute without a program for attribute ndCoordIn
ERROR:root:Couldn't build the shader program for resolving msaa.
Triangle neighbors and vertex normals...
Using low resolution head model in /home/pascal/Documents/meg_study_data/MRI_Subjects/S006/bem/outer_skin.surf
Triangle neighbors and vertex normals...
Estimating fiducials from fsaverage.
Triangle neighbors and vertex normals...
Using low resolution head model in /home/pascal/Documents/meg_study_data/MRI_Subjects/S006/bem/outer_skin.surf
Triangle neighbors and vertex normals...
Estimating fiducials from fsaverage.
Estimating fiducials from fsaverage.
Placing MRI fiducials - LPA
Using outer_skin.surf for head surface.
Placing MRI fiducials - LPA
qt.qpa.xcb: X server does not support XInput 2
qt.qpa.xcb: QXcbConnection: XCB error: 1 (BadRequest), sequence: 169, resource id: 132, major code: 130 (Unknown), minor code: 47
qt.qpa.gl: QXcbConnection: Failed to initialize GLX
2023-01-12 11:06:22.668 ( 3,259s) [ D9F1E740] vtkShaderProgram.cxx:452 ERR| vtkShaderProgram (0x5617b0d16240): 1:
2: #version 140
3: #ifdef GL_ES
4: #ifdef GL_FRAGMENT_PRECISION_HIGH
5: precision highp float;
6: precision highp sampler2D;
7: precision highp sampler3D;
8: #else
9: precision mediump float;
10: precision mediump sampler2D;
11: precision mediump sampler3D;
12: #endif
13: #define texelFetchBuffer texelFetch
14: #define texture1D texture
15: #define texture2D texture
16: #define texture3D texture
17: #else // GL_ES
18: #define highp
19: #define mediump
20: #define lowp
21: #if __VERSION__ == 150
22: #define texelFetchBuffer texelFetch
23: #define texture1D texture
24: #define texture2D texture
25: #define texture3D texture
26: #endif
27: #endif // GL_ES
28: #define varying in
29:
30: in vec2 texCoord;
31: uniform sampler2DMS tex;
32: uniform int samplecount;
33: out vec4 fragOutput0;
34:
35:
36: void main()
37: {
38: float gamma = 2.2;
39:
40: // for each sample in the multi sample buffer...
41: ivec2 itexcoords = ivec2(floor(textureSize(tex) * texCoord));
42: vec3 accumulate = vec3(0.0,0.0,0.0);
43: float alpha = 0.0;
44:
45: for (int i = 0; i < samplecount; i++)
46: {
47: vec4 sample = texelFetch(tex, itexcoords, i);
48: // apply gamma correction and sum
49: accumulate += pow(sample.rgb, vec3(gamma));
50: alpha += sample.a;
51: }
52:
53: // divide and reverse gamma correction
54: accumulate /= float(samplecount);
55: fragOutput0 = vec4(pow(accumulate, vec3(1.0/gamma)), alpha/float(samplecount));
56: }
57:
2023-01-12 11:06:22.669 ( 3,260s) [ D9F1E740] vtkShaderProgram.cxx:453 ERR| vtkShaderProgram (0x5617b0d16240): 0:31(22): error: syntax error, unexpected NEW_IDENTIFIER, expecting '{'
2023-01-12 11:06:22.669 ( 3,261s) [ D9F1E740]vtkOpenGLVertexArrayObj:265 ERR| vtkOpenGLVertexArrayObject (0x5617b1c8d660): attempt to add attribute without a program for attribute ndCoordIn
2023-01-12 11:06:22.669 ( 3,261s) [ D9F1E740]vtkOpenGLQuadHelper.cxx:70 WARN| Error binding ndCoords to VAO.
2023-01-12 11:06:22.669 ( 3,261s) [ D9F1E740]vtkOpenGLRenderWindow.c:1099 ERR| vtkXOpenGLRenderWindow (0x5617b0dc3520): Couldn't build the shader program for resolving msaa.
I then close the PyVista Scene, and the kernel automatically restarts again with the following output:
<mne.gui._coreg.CoregistrationUI at 0x7fd98962a830>
/home/pascal/anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh: line 18: 2870349 Killed $CONDA_ENV_PYTHON -m spyder_kernels.console -f $SPYDER_KERNEL_SPEC
Restarting kernel...
I have looked around here in the discourse group and online for solutions, but have not found any that helped. Importantly, and what I suggest might play a role in this, I am using x2go server from my windows computer to a Linux system. Below, I provided MNE version, operating system, and MNE sys info. For pyvista, which I installed for the visualization, it says that OpenGL could not be initialized. This might be problematic for the visualization? I don’t know how to fix this though.
- MNE version: 1.2.0
- operating system: Ubuntu 20.04
- MNE sys_info:
Platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.31
Python: 3.9.12 (main, Apr 5 2022, 06:56:58) [GCC 7.5.0]
Executable: /home/pascal/anaconda3/bin/python
CPU: x86_64: 6 cores
Memory: 15.4 GB
mne: 1.2.0
numpy: 1.21.5 {MKL 2021.4-Product with 6 threads}
scipy: 1.7.3
matplotlib: 3.5.2 {backend=QtAgg}
sklearn: 1.0.2
numba: 0.55.1
nibabel: 4.0.2
nilearn: Not found
dipy: Not found
openmeeg: Not found
cupy: Not found
pandas: 1.4.4
pyvista: 0.37.0 {OpenGL could not be initialized}
pyvistaqt: 0.9.0
ipyvtklink: Not found
vtk: 9.2.5
qtpy: 2.2.0 {PyQt5=5.15.2}
ipympl: Not found
pyqtgraph: Not found
pooch: v1.6.0
mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
mne_icalabel: Not found
Quite an extensive thread, I hope to have provided all the necessary information for you to have a look into it and maybe provide a suggestion.
Grateful for your help!
Kind regards
Pascal