OHBA-analysis / osl

OHBA Software Library - MEG/EEG Analysis Tools
https://osl.readthedocs.io/en/latest/
Other
39 stars 8 forks source link

Source Recon 3D backend issue in VSCode #232

Closed matsvanes closed 9 months ago

matsvanes commented 11 months ago

I believe pyvistaqt might be a requirement for the source_recon module, as I get this error when I'm running coreg without having it installed (currently pyvistaqt is not in our requirements).

OSL osl_logger: handler 'console' level set to 'INFO'
 logging to file: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log)
 Starting OSL Batch Source Reconstruction
 Running config
 {'source_recon': [{'extract_fiducials_from_fif': {}},
                  {'fix_headshape_points': {}},
                  {'custom_coregister': {}}]}
C1013_resting_open_bl_tsss_preproc_raw : OSL osl_logger: handler 'console' level set to 'INFO'
C1013_resting_open_bl_tsss_preproc_raw : logging to file: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/C1013_resting_open_bl_tsss_preproc_raw_src.log](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/C1013_resting_open_bl_tsss_preproc_raw_src.log)
C1013_resting_open_bl_tsss_preproc_raw : 2023-10-31 12:50:02 : Starting OSL Processing
C1013_resting_open_bl_tsss_preproc_raw : input : [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl)
C1013_resting_open_bl_tsss_preproc_raw : Setting up polhemus files
C1013_resting_open_bl_tsss_preproc_raw : saved: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt)
C1013_resting_open_bl_tsss_preproc_raw : saved: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_nasion.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_nasion.txt)
C1013_resting_open_bl_tsss_preproc_raw : saved: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_rpa.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_rpa.txt)
C1013_resting_open_bl_tsss_preproc_raw : saved: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_lpa.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_lpa.txt)
C1013_resting_open_bl_tsss_preproc_raw : overwritting [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt)
C1013_resting_open_bl_tsss_preproc_raw : *** RUNNING OSL RHINO COMPUTE SURFACES ***
C1013_resting_open_bl_tsss_preproc_raw : The nose is going to be added to the outer skin (scalp) surface.
C1013_resting_open_bl_tsss_preproc_raw : Please ensure that the structural MRI has a FOV that includes the nose
C1013_resting_open_bl_tsss_preproc_raw : reorienting subject brain to be RADIOLOGICAL
C1013_resting_open_bl_tsss_preproc_raw : You can use the following call to check the passed in structural MRI is appropriate,
C1013_resting_open_bl_tsss_preproc_raw : including checking that the L-R, S-I, A-P labels are sensible:
C1013_resting_open_bl_tsss_preproc_raw : In Python:
C1013_resting_open_bl_tsss_preproc_raw : fsleyes("/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/smri.nii.gz", "/opt/ohba/fsl/6.0.5/data/standard/MNI152_T1_1mm_brain.nii.gz")
C1013_resting_open_bl_tsss_preproc_raw : From the cmd line:
C1013_resting_open_bl_tsss_preproc_raw : fsleyes [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/smri.nii.gz](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/smri.nii.gz) [/opt/ohba/fsl/6.0.5/data/standard/MNI152_T1_1mm_brain.nii.gz](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/opt/ohba/fsl/6.0.5/data/standard/MNI152_T1_1mm_brain.nii.gz)
C1013_resting_open_bl_tsss_preproc_raw : Running BET pre-FLIRT...
C1013_resting_open_bl_tsss_preproc_raw : Running FLIRT...
C1013_resting_open_bl_tsss_preproc_raw : Running BET and BETSURF...
C1013_resting_open_bl_tsss_preproc_raw : Refining scalp surface...
C1013_resting_open_bl_tsss_preproc_raw : Adding nose to scalp surface...
C1013_resting_open_bl_tsss_preproc_raw : rhino.surfaces.surfaces_display("/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source", "C1013_resting_open_bl") can be used to check the result
C1013_resting_open_bl_tsss_preproc_raw : *** OSL RHINO COMPUTE SURFACES COMPLETE ***
C1013_resting_open_bl_tsss_preproc_raw : Saving [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/inskull.png](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/inskull.png)
C1013_resting_open_bl_tsss_preproc_raw : Saving [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/outskull.png](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/outskull.png)
C1013_resting_open_bl_tsss_preproc_raw : Saving [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/outskin.png](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/outskin.png)
C1013_resting_open_bl_tsss_preproc_raw : Saving [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/outskin_plus_nose.png](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces/outskin_plus_nose.png)
C1013_resting_open_bl_tsss_preproc_raw : *** RUNNING OSL RHINO COREGISTRATION ***
C1013_resting_open_bl_tsss_preproc_raw : The MRI-derived nose is going to be used to aid coreg.
C1013_resting_open_bl_tsss_preproc_raw : Please ensure that rhino.compute_surfaces was run with include_nose=True.
C1013_resting_open_bl_tsss_preproc_raw : Please ensure that the polhemus headshape points include the nose.
C1013_resting_open_bl_tsss_preproc_raw : loading: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt)
C1013_resting_open_bl_tsss_preproc_raw : loading: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_nasion.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_nasion.txt)
C1013_resting_open_bl_tsss_preproc_raw : loading: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_rpa.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_rpa.txt)
C1013_resting_open_bl_tsss_preproc_raw : loading: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_lpa.txt](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_lpa.txt)
C1013_resting_open_bl_tsss_preproc_raw : Running ICP...
C1013_resting_open_bl_tsss_preproc_raw : ICP found better xform, error=2.7041529319876356
C1013_resting_open_bl_tsss_preproc_raw : rhino.coreg_display("/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source", "C1013_resting_open_bl") can be used to check the result
C1013_resting_open_bl_tsss_preproc_raw : *** OSL RHINO COREGISTRATION COMPLETE ***
C1013_resting_open_bl_tsss_preproc_raw : *********************************
C1013_resting_open_bl_tsss_preproc_raw : * SOURCE RECONSTRUCTION FAILED! *
C1013_resting_open_bl_tsss_preproc_raw : *********************************
C1013_resting_open_bl_tsss_preproc_raw : custom_coregister : <function custom_coregister at 0x7f0cee06c5e0>
C1013_resting_open_bl_tsss_preproc_raw : <class 'RuntimeError'>
C1013_resting_open_bl_tsss_preproc_raw : Could not load any valid 3D backend
pyvistaqt: No module named 'pyvistaqt'
notebook: No module named 'pyvistaqt'

 install pyvistaqt, using pip or conda:
'pip install pyvistaqt'
'conda install -c conda-forge pyvistaqt'

 or install ipywidgets, if using a notebook backend
'pip install ipywidgets'
'conda install -c conda-forge ipywidgets'
C1013_resting_open_bl_tsss_preproc_raw : None
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/osl/source_recon/batch.py", line 183, in run_src_chain
  File "<ipython-input-1-26cd8658adc8>", line 182, in custom_coregister
    source_recon.wrappers.coregister(
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/osl/source_recon/wrappers.py", line 194, in coregister
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/osl/source_recon/rhino/coreg.py", line 643, in coreg_display
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/mne/viz/backends/renderer.py", line 49, in _get_renderer
    _get_3d_backend()
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/mne/viz/backends/renderer.py", line 178, in _get_3d_backend
    raise RuntimeError(
 OSL osl_logger: handler 'console' level set to 'INFO'
 logging to file: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log)
 Processed 0/1 files successfully
cgohil8 commented 11 months ago

This should be handled in the environment files. I would reinstall following the instruction on the github homepage readme and see if this problem still occurs.

matsvanes commented 11 months ago

I reinstalled osl and got a different (but related) error, regarding the 3D backend. I was running the code in VSCode, and I didn't get the issue in the terminal. So this is likely VSCode related (beware!)

The error I got after reinstallation:

OSL osl_logger: handler 'console' level set to 'INFO'
 logging to file: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log
 Starting OSL Batch Source Reconstruction
 Running config
 {'source_recon': [{'extract_fiducials_from_fif': {}},
                  {'fix_headshape_points': {}},
                  {'custom_coregister': {}}]}
C1013_resting_open_bl_tsss_preproc_raw : OSL osl_logger: handler 'console' level set to 'INFO'
C1013_resting_open_bl_tsss_preproc_raw : logging to file: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/C1013_resting_open_bl_tsss_preproc_raw_src.log
C1013_resting_open_bl_tsss_preproc_raw : 2023-10-31 13:11:58 : Starting OSL Processing
C1013_resting_open_bl_tsss_preproc_raw : input : /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl
C1013_resting_open_bl_tsss_preproc_raw : Setting up polhemus files
C1013_resting_open_bl_tsss_preproc_raw : saved: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt
C1013_resting_open_bl_tsss_preproc_raw : saved: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_nasion.txt
C1013_resting_open_bl_tsss_preproc_raw : saved: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_rpa.txt
C1013_resting_open_bl_tsss_preproc_raw : saved: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_lpa.txt
C1013_resting_open_bl_tsss_preproc_raw : overwritting /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt
C1013_resting_open_bl_tsss_preproc_raw : *** OSL RHINO: USING PREVIOUSLY COMPUTED SURFACES ***
C1013_resting_open_bl_tsss_preproc_raw : Surfaces directory: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/surfaces
C1013_resting_open_bl_tsss_preproc_raw : include_nose=True
C1013_resting_open_bl_tsss_preproc_raw : *** RUNNING OSL RHINO COREGISTRATION ***
C1013_resting_open_bl_tsss_preproc_raw : The MRI-derived nose is going to be used to aid coreg.
C1013_resting_open_bl_tsss_preproc_raw : Please ensure that rhino.compute_surfaces was run with include_nose=True.
C1013_resting_open_bl_tsss_preproc_raw : Please ensure that the polhemus headshape points include the nose.
C1013_resting_open_bl_tsss_preproc_raw : loading: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_headshape.txt
C1013_resting_open_bl_tsss_preproc_raw : loading: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_nasion.txt
C1013_resting_open_bl_tsss_preproc_raw : loading: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_rpa.txt
C1013_resting_open_bl_tsss_preproc_raw : loading: /ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/C1013_resting_open_bl/rhino/coreg/polhemus_lpa.txt
C1013_resting_open_bl_tsss_preproc_raw : Running ICP...
C1013_resting_open_bl_tsss_preproc_raw : ICP found better xform, error=2.7041529319876356
C1013_resting_open_bl_tsss_preproc_raw : rhino.coreg_display("/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source", "C1013_resting_open_bl") can be used to check the result
C1013_resting_open_bl_tsss_preproc_raw : *** OSL RHINO COREGISTRATION COMPLETE ***
C1013_resting_open_bl_tsss_preproc_raw : *********************************
C1013_resting_open_bl_tsss_preproc_raw : * SOURCE RECONSTRUCTION FAILED! *
C1013_resting_open_bl_tsss_preproc_raw : *********************************
C1013_resting_open_bl_tsss_preproc_raw : custom_coregister : <function custom_coregister at 0x7f0cee06c5e0>
C1013_resting_open_bl_tsss_preproc_raw : <class 'ImportError'>
C1013_resting_open_bl_tsss_preproc_raw : Initialization failed for vtkWebCore, not compatible with vtkmodules.vtkCommonCore
C1013_resting_open_bl_tsss_preproc_raw : None
 OSL osl_logger: handler 'console' level set to 'INFO'
 logging to file: [/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log](https://vscode-remote+ssh-002dremote-002bhbaws46.vscode-resource.vscode-cdn.net/ohba/pi/mwoolrich/mvanes/Projects/NTAD/source/logs/osl_batch.log)
 Processed 0/1 files successfully
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/osl/source_recon/batch.py", line 183, in run_src_chain
  File "<ipython-input-1-26cd8658adc8>", line 182, in custom_coregister
    source_recon.wrappers.coregister(
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/osl/source_recon/wrappers.py", line 194, in coregister
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/osl/source_recon/rhino/coreg.py", line 643, in coreg_display
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/mne/viz/backends/renderer.py", line 50, in _get_renderer
    _check_option('backend_name', backend_name, VALID_3D_BACKENDS)
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/mne/viz/backends/_notebook.py", line 1432, in __init__
    super().__init__(*args, **kwargs)
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/mne/viz/backends/_pyvista.py", line 227, in __init__
    self.plotter = self.figure._build()
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/mne/viz/backends/_pyvista.py", line 134, in _build
    plotter = self._plotter_class(**self.store)
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/pyvista/plotting/plotting.py", line 5870, in __init__
    @property
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/pyvista/plotting/plotting.py", line 1794, in enable_trackball_style
    def add_on_render_callback(self, callback, render_event=False):
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/pyvista/plotting/render_window_interactor.py", line 347, in enable_trackball_style
    renderer.set_chart_interaction(False)
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/pyvista/plotting/render_window_interactor.py", line 291, in update_style
    """Clear key event callbacks."""
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/pyvista/plotting/render_window_interactor.py", line 910, in _style_factory
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/pyvista/plotting/render_window_interactor.py", line 866, in _make_class
    def initialize(self):
  File "/home/mvanes/anaconda3/envs/osl/lib/python3.8/site-packages/vtk.py", line 5, in <module>
    from vtkmodules.vtkWebCore import *
cgohil8 commented 11 months ago

This is probably still worth resolving - i'd keep this issue open as something to look into in the future. VSCode is very popular.

matsvanes commented 9 months ago

Haven't encountered this recently after a fresh install. Closing as seems irrelevant.