Error loading overlay

Description

I wanted to view my results. But fsleyes opens and shut downs within a second with a message : “Failed to load plugin file /Users/cesarfarah/.fsleyes/plugins/sct_plugin.py: invalid syntax (sct_plugin.py, line 23)”

Commands and terminal output

> (base) Cesars-MacBook-Pro:docker cesarfarah$ fsleyes

Failed to load plugin file /Users/cesarfarah/.fsleyes/plugins/sct_plugin.py: invalid syntax (sct_plugin.py, line 23)

sct_check_dependencies

SCT info:
- version: 5.2.0
- path: /Users/cesarfarah/sct_5.2.0
OS: osx (Darwin-18.7.0-x86_64-i386-64bit)
CPU cores: Available: 4, Used by ITK functions: 4
RAM: Total: 8192MB, Used: 4068MB, Available: 3077MB
Check Python executable.............................[OK]
Using bundled python 3.6.13 |Anaconda, Inc.| (default, Feb 23 2021, 12:58:59) 
[GCC Clang 10.0.0 ] at /Users/cesarfarah/sct_5.2.0/python/envs/venv_sct/bin/python
Check if data are installed.........................[OK]
Check if colored is installed.......................[OK] (1.4.2)
Check if dipy is installed..........................[OK] (1.3.0)
Check if futures is installed.......................[OK]
Check if h5py is installed..........................[OK] (2.10.0)
Check if Keras (2.1.5) is installed.................[OK] (2.1.5)
Check if ivadomed (2.7.2) is installed..............[OK] (2.7.2)
Check if matplotlib is installed....................[OK] (3.3.4)
Check if nibabel is installed.......................[OK] (3.2.1)
Check if numpy is installed.........................[OK] (1.19.5)
Check if onnxruntime (1.4.0) is installed...........[OK] (1.4.0)
Check if pandas is installed........................[OK] (1.1.5)
Check if psutil is installed........................[OK] (5.8.0)
Check if pyqt5 (5.11.3) is installed................[OK] (5.11.3)
Check if pytest is installed........................[OK] (6.2.2)
Check if pytest-cov is installed....................[OK] (__version__ = '2.11.1')
Check if raven is installed.........................[OK]
Check if requests is installed......................[OK] (2.25.1)
Check if requirements-parser is installed...........[OK] (0.2.0)
Check if scipy is installed.........................[OK] (1.5.4)
Check if scikit-image is installed..................[OK] (0.17.2)
Check if scikit-learn is installed..................[OK] (0.24.1)
Check if tensorflow (1.5.0) is installed............[OK] (1.5.0)
Check if torch (1.5.0) is installed.................[OK] (1.5.0)
Check if torchvision (0.6.0) is installed...........[OK] (0.6.0)
Check if xlwt is installed..........................[OK] (1.3.0)
Check if tqdm is installed..........................[OK] (4.57.0)
Check if transforms3d is installed..................[OK] (0.3.1)
Check if urllib3 is installed.......................[OK] (1.26.3)
Check if pytest_console_scripts is installed........[OK]
Check if spinalcordtoolbox is installed.............[OK]
Check ANTs compatibility with OS ...................[OK]
Check PropSeg compatibility with OS ................[OK]
Check if DISPLAY variable is set....................[OK]
Check if figure can be opened with PyQt.............[OK]

File upload

Hmm weird @Kfarah. I looked at the code and line 23 is the first line of the script that’s not a comment:

Plus, the installer doesn’t install or update the plugin because it’s not that well tested I guess. It needs to be done manually – I guess you probably followed https://spinalcordtoolbox.com/en/stable/user_section/fsleyes.html#sct-fsleyes at some point? Did you redo them for version 5.2.0?

I think the problem is that the script is missing this line at the top:

#!/usr/bin/env python3

so that it’s being run as a bash script. Maybe FSLeyes used to assume all scripts were python, but now doesn’t? If you add that line to the top of the script does it change what happens?

Thank @nguenthe you for your response.
I actually followed [https://spinalcordtoolbox.com/en/stable/user_section/fsleyes.html#sct-fsleyes ](https://spinalcordtoolbox.com/en/stable/user_section/fsleyes.html#sct-fsleyes
Even when redoing them, it was not working.

When i add #!/usr/bin/env python3 to the script, i still have the same problem.

I don’t know what to do…

@Kfarah you are trying to load it as a “plugin”, while it should be loaded as a “script”:

I know this is confusing, because we called the file “sct_plugin.py”…

Thank you @jcohenadad.

I did this but, when i try to load an image, i have this message:

An error occurred loading the image /Users/cesarfarah/Desktop/These Science/These science Myelopathie/Sujets travailler/1er Cas/MC_P025_followupAandC/MC_P025c/01_0006_t1-mp2rage-3d-1mm-ti650-2000-t1-images/01_0006_t1-mp2rage-3d-1mm-ti650-2000-t1-images_T1_MP2RAGE_3D_1mm_TI650-2000_20190820142317_6_rescaled_CSF_mesh.vtk

Details: cannot copy sequence with size 9 to array axis with dimension 3.

you are trying to load a VTK file. FSLeyes only loads NIfTI files (nii or nii.gz extensions).

also: you have “space” in your path name, which is not compatible with FSLeyes (and UNIX in general). My suggestion: never use space in your folder/file names. Replace with “_” or “-”.

Hi @Kfarah, is everything working for you now? Can we consider this thread “resolved”?