EtienneCmb / visbrain

A multi-purpose GPU-accelerated open-source suite for brain data visualization
http://visbrain.org
Other
242 stars 65 forks source link

Encountering an error when running a demo code (sometimes) #52

Open devangini27 opened 4 years ago

devangini27 commented 4 years ago

I'm trying to run the demo code for cross-section control: http://visbrain.org/auto_examples/gui_brain/01_cross_sections_and_volume.html. My code works at times and sometimes it produces the following output.

File already dowloaded (/home/deeplearning/visbrain_data/example_data/GG-853-WM-0.7mm.nii.gz).
CrossSecObj(name='/home/deeplearning/visbrain_data/example_data/GG-853-WM-0.7mm.nii.gz') created
    GG-853-WM-0.7mm volume loaded
VolumeObj(name='/home/deeplearning/visbrain_data/example_data/GG-853-WM-0.7mm.nii.gz') created
    GG-853-WM-0.7mm volume loaded
GG-853-WM-0.7mm is now a default ROI object. Use `r_obj = RoiObj('GG-853-WM-0.7mm')` to call it.
RoiObj(name='brodmann') created
    brodmann ROI loaded.
BrainObj(name='B1') created
Traceback (most recent call last):
  File "/home/deeplearning/Documents/LiClipse Workspace/fMRI_iML/src/deepbrain/main.py", line 115, in <module>
    vis.showCrossSections()
  File "/home/deeplearning/Documents/LiClipse Workspace/fMRI_iML/src/utils/Visualization.py", line 346, in showCrossSections
    vb = Brain(cross_sec_obj=cs_obj, vol_obj=v_obj)
  File "/usr/local/lib/python3.5/dist-packages/visbrain/gui/brain/brain.py", line 126, in __init__
    BrainCbar.__init__(self, camera)
  File "/usr/local/lib/python3.5/dist-packages/visbrain/gui/brain/cbar.py", line 65, in __init__
    self.cbqt._fcn_change_object()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/visuals/cbar/CbarQt.py", line 306, in _fcn_change_object
    self._initialize()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/visuals/cbar/CbarQt.py", line 258, in _initialize
    self._gui_to_visual()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/visuals/cbar/CbarQt.py", line 273, in _gui_to_visual
    self._fcn_cmap_changed()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/visuals/cbar/CbarQt.py", line 15, in wrapper
    fn(self)
  File "/usr/local/lib/python3.5/dist-packages/visbrain/visuals/cbar/CbarQt.py", line 360, in _fcn_cmap_changed
    self.cbobjs.update()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/visuals/cbar/CbarObjects.py", line 135, in update
    self._objs[self._selected]._fcn()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/gui/brain/cbar.py", line 103, in _fcn_link_roi
    self.roi._update_cbar()
  File "/usr/local/lib/python3.5/dist-packages/visbrain/objects/roi_obj.py", line 660, in _update_cbar
    self.mesh.update_colormap(**self.to_kwargs())
AttributeError: 'RoiObj' object has no attribute 'mesh'

Please help me.

EtienneCmb commented 4 years ago

@devangini27 You means that sometime it works and sometime it failed?

devangini27 commented 4 years ago

@EtienneCmb Yes, sometimes the code runs but sometimes it fails and it outputs the above error message. It happens randomly so I don't know what causes that error message.

EtienneCmb commented 4 years ago

from which environment are you launching the code? spyder, pycharm, a terminal?

devangini27 commented 4 years ago

I'm running the code from Liclipse. Could that be a problem?

EtienneCmb commented 4 years ago

I don't know it, but I know that for example Pycharm IDE can produces random errors because of bad "interactions" with PyQt (which is used to create GUI elements). You should try to run your scripts from a terminal and see if there's still a random behavior.

devangini27 commented 4 years ago

I ran the code in the terminal and it produced the same error message.