rordenlab / MRIcroGL

v1.2 GLSL volume rendering. Able to view NIfTI, DICOM, MGH, MHD, NRRD, AFNI format images.
https://www.nitrc.org/plugins/mwiki/index.php/mricrogl:MainPage
Other
204 stars 32 forks source link

Loads blank window on startup, is this the “long wait” from the notification? #49

Closed TheChymera closed 1 year ago

TheChymera commented 1 year ago

So when I start MRIcroGL I get a blank window, after which I can either wait a while or just close it, and the viewer starts up normally.

I also see this in the command line:

[deco]~ ❱ MRIcroGL
If there is a long delay at launch, ensure full GTK2 install: "sudo apt-get install appmenu-gtk2-module"
Unable to find AFNI_ATLAS_PATH
Loading preferences /home/chymera/.MRIcroGL12.ini
Unable to find folder "/usr/share/MRIcroGL/standard"
Unable to find folder "/usr/share/MRIcroGL/atlas"
Load time 26
float range 0..0.94197642803192139
float window 0...0.83225166797637939
Init time 5
Set Min/Max Window 0..0.83225166797637939 time 1
Update RGBA time 1

Is this the issue I'm getting? If so, what file does it need exactly? that's as far as I can tell a specific package name from Debian or Ubuntu.

Also, for reference I tried both =mricrogl-1.2.20211007 and =mricrogl-1.2.20220720, both of them with either

lazbuild -B --lazarusdir="/usr/share/lazarus/" --pcp="system-lazarus-config" MRIcroGL_Debian.lpi || die

or

lazbuild -B --lazarusdir="/usr/share/lazarus/" --pcp="system-lazarus-config" MRIcroGL_NoPython.lpi || die

all 4 with the same results.

neurolabusc commented 1 year ago

@TheChymera this is a limitation of your OS support for GTK2, not a problem with MRIcroGL. You will see this delay for any GTK2-based application.

It might be worth getting more details about your distribution. As a first pass, have you considered upgrading your distribution? This problem was common several years ago when there was a push for applications to use GTK3, deprecating GTK2. Most distributions now provide better backward compatibility for GTK2 based apps. This is likely a sign that you are using an old distribution. Note while we could provide MRIcroGL compiled for GTK3, it would inherently degrade the quality of the visualization. Unfortunately, GTK3 never enabled multi-sampling for OpenGL components so the visual quality is poor relative to GTK2.

You can probably find a solution for your distribution by doing a web search with your distribution name, for example if you use Ubuntu you could search for:

ubuntu launch gtk2 dbus delay

Which would suggest a solution:

sudo apt-get install appmenu-gtk2-module
sudo apt-get install libcanberra-gtk-module

Another option would be to use the QT5 widgets instead of the GTK2 widgetset. See the release notes named MRIcroGL_Linux_Installation.txt that come with the distribution. The challenge is that QT5 support is recent, and several older distributions are frozen with somewhat limited support. The contents of the installation notes are:

Two versions of MRIcroGL are provided:

1.) "MRIcroGL" uses the GTK2 widgetset. This is recommended for Ubuntu 19.04 and earlier. For Ubuntu 19.10 or later you will need to install GTK2 to run this version (run "sudo apt-get install appmenu-gtk2-module" and then restart).

2.) "MRIcroGL_QT" uses the QT5 widgetset. This is recommended for Ubuntu 19.10 or later. 
 - On Ubuntu 19.10 or later you should run "sudo apt install libqt5pas1" to install the supporting libraries.
 - QT5 is not well supported on Ubuntu 16.04 and earlier.
 - The QT5 header library provided for Ubuntu 18.04 has issues. If you do want to use "MRIcroGL_QT" on Ubuntu 18.04 you will need to run the following commands:

wget -O- http://neuro.debian.net/lists/bionic.us-nh.libre | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
sudo apt-get update
sudo apt install libqt5pas1

If this does not work, try installing the .deb (if you are using a Deiban-based distribtuion like Ubuntu) or .rpm (if you are using a Red Hat distribution) file found here: 
  https://github.com/davidbannon/libqt5pas/releases/tag/v1.2.9

Troubleshooting.

If you have problems, see
  https://www.mccauslandcenter.sc.edu/mricrogl/troubleshooting

MRIcroGL requires a Graphics card and driver that supports OpenGL Core 3.3 or later. You can find out about your graphics card and driver with the following commands:

lspci | grep VGA
lsmod | grep "kms\|drm"
find /dev -group video
cat /proc/cmdline
find /etc/modprobe.d/
cat /etc/modprobe.d/*kms*
ls /etc/X11/xorg.conf
glxinfo | grep -i "vendor\|rendering"
grep LoadModule /var/log/Xorg.0.log

If "lspci | grep VGA" lists your graphics card as "NVidia" but "glxinfo | grep -i "vendor\|rendering"" lists your driver as Mesa or "nouveau" you should consider upgrading to the genuine NVidia graphics driver which will provide much better performance:
  https://www.phoronix.com/scan.php?page=article&item=nouveau-summer-2018&num=1

fsl_anat -i "/home/chris/Ref/In/T1.nii" -o /home/chris/Ref/Out6/struc
neurolabusc commented 1 year ago

To compile for QT5, you can select it as your widgetset:

lazbuild  -B --ws=qt5 MRIcroGL.lpi

However, this assumes your distribution supports QT5 and has a libqt5pas library installed.

TheChymera commented 1 year ago

@neurolabusc thank you for the detailed response. As it turns out, the package actually exists, it's just named appmenu-gtk-module with gtk2 being an optional feature that can be enabled instead of the name of a separate package. This doesn't seem to solve the issue, though:

Here's a screenrecorded demo https://ppb.chymera.eu/68bdcc.mp4

The traceback tells the same story, though, the ones with the failed assertion being the ones where I either need to wait or close the first window manually:

[deco]~ ❱ MRIcroGL
If there is a long delay at launch, ensure full GTK2 install: "sudo apt-get install appmenu-gtk2-module"
Unable to find AFNI_ATLAS_PATH
Loading preferences /home/chymera/.MRIcroGL12.ini
Unable to find folder "/usr/share/MRIcroGL/standard"
Unable to find folder "/usr/share/MRIcroGL/atlas"
Load time 9
float range 0..0.94197642803192139
float window 0...0.83225166797637939
Init time 8
Set Min/Max Window 0..0.83225166797637939 time 1
Update RGBA time 2
[deco]~ ❱ MRIcroGL
If there is a long delay at launch, ensure full GTK2 install: "sudo apt-get install appmenu-gtk2-module"
Unable to find AFNI_ATLAS_PATH
Loading preferences /home/chymera/.MRIcroGL12.ini
Unable to find folder "/usr/share/MRIcroGL/standard"
Unable to find folder "/usr/share/MRIcroGL/atlas"
Load time 9
float range 0..0.94197642803192139
float window 0...0.83225166797637939
Init time 8
Set Min/Max Window 0..0.83225166797637939 time 1
Update RGBA time 2
[deco]~ ❱ MRIcroGL

(MRIcroGL:15443): Gtk-CRITICAL **: 14:01:12.304: IA__gtk_widget_hide: assertion 'GTK_IS_WIDGET (widget)' failed

(MRIcroGL:15443): Gtk-CRITICAL **: 14:01:12.304: IA__gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed
If there is a long delay at launch, ensure full GTK2 install: "sudo apt-get install appmenu-gtk2-module"
Unable to find AFNI_ATLAS_PATH
Loading preferences /home/chymera/.MRIcroGL12.ini
Unable to find folder "/usr/share/MRIcroGL/standard"
Unable to find folder "/usr/share/MRIcroGL/atlas"
Load time 9
float range 0..0.94197642803192139
float window 0...0.83225166797637939
Init time 7
Set Min/Max Window 0..0.83225166797637939 time 1
Update RGBA time 2
[deco]~ ❱ MRIcroGL

(MRIcroGL:15679): Gtk-CRITICAL **: 14:01:28.575: IA__gtk_widget_hide: assertion 'GTK_IS_WIDGET (widget)' failed

(MRIcroGL:15679): Gtk-CRITICAL **: 14:01:28.575: IA__gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed
If there is a long delay at launch, ensure full GTK2 install: "sudo apt-get install appmenu-gtk2-module"
Unable to find AFNI_ATLAS_PATH
Loading preferences /home/chymera/.MRIcroGL12.ini
Unable to find folder "/usr/share/MRIcroGL/standard"
Unable to find folder "/usr/share/MRIcroGL/atlas"
Load time 9
float range 0..0.94197642803192139
float window 0...0.83225166797637939
Init time 8
Set Min/Max Window 0..0.83225166797637939 time 1
Update RGBA time 2

In case this is relevant, I also rebuilt MRIcroGL after installing the package, in case it was somehow statically linked. But same thing. Could it be wayland that's getting in the way?

In the mean time I also tried libcanberra with the same results. Sometimes it still hangs on the first window. Here's double checking that the gtk2 support is enabled for both of them:

[deco]~ ❱ equery u libcanberra
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for media-libs/libcanberra-0.30-r7:
 U I
 - - abi_x86_32 : 32-bit (x86) libraries
 + + alsa       : Enables ALSA sound driver.
 - - gnome      : Add GNOME support
 - - gstreamer  : Enables gstreamer sound driver. Not useful when alsa or pulseaudio is available.
 + + gtk2       : Enables building of gtk+ helper library, gtk+ runtime sound effects and the canberra-gtk-play utility. To enable the gtk+
                  sound effects add canberra-gtk-module to the colon separated list of modules in the GTK_MODULES environment variable.
 + + gtk3       : Enables building of gtk+3 helper library, gtk+3 runtime sound effects and the canberra-gtk-play utility. To enable the
                  gtk+3 sound effects add canberra-gtk-module to the colon separated list of modules in the GTK_MODULES environment
                  variable.
 - - oss        : Add support for OSS (Open Sound System)
 + + pulseaudio : Enables PulseAudio sound driver that should be able to support positional event sounds. This is the preferred choice for
                  best sound events experience and picked by default if compiled in and possible to use at runtime.
 + + sound      : Install x11-themes/sound-theme-freedesktop to get sounds on Gnome and Xfce.
 - - tdb        : Enables Trivial Database support for caching purposes.
 + + udev       : Enable virtual/udev integration (device discovery, power and storage device support, etc)
[deco]~ ❱ equery u appmenu-gtk-module
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for x11-misc/appmenu-gtk-module-0.7.6:
 U I
 - + gtk2    : Build module for GTK+2
 + + wayland : Enable dev-libs/wayland backend
neurolabusc commented 1 year ago

I am unable to replicate this behavior on any distributions I use. For modern distributions, I would check if the QT5 works correctly. You might want to encourage the GTK developers to consider enabling multi-sampling for GTK4. You may also want to see if NiiVue fulfills your needs. It is zero-footprint and uses WegGL's 2 ANGLE, so it should use the optimal driver for your computer (OpenGL, Metal, Vulkan, DirectX) and will work on any modern computer, phone or tablet.