dicompyler icon indicating copy to clipboard operation
dicompyler copied to clipboard

Linux Mint 19 invalid values in wxGauge::SetValue()

Open c-amow opened this issue 5 years ago • 3 comments

Install of the various pieces seemed to all eventually go through without any errors.

Using the two files at https://medistim.com/dicom/ On linux (based on ubuntu 18.04) I can only get bmode.dcm to "Open quickly" and then when I select Ultrasound Multi-frame Image, the Loading DICOM data progress bar comes up and gets to 98% before emitting (and then hanging indefinitely):

(dicompyler:14156): Gtk-WARNING **: 03:01:55.686: Negative content width -1 (allocation 12, extents 6x7) while allocating gadget (node button, owner GtkButton)
ERROR: Unhandled exception: Traceback (most recent call last):
 File "/home/chris/.local/lib/python2.7/site-packages/wx/core.py", line 3240, in <lambda>
   lambda event: event.callable(*event.args, **event.kw) )
 File "/home/chris/.local/lib/python2.7/site-packages/dicompyler/guiutil.py", line 134, in OnUpdateProgress
   self.gaugeProgress.SetValue(percentDone)
wxAssertionError: C++ assertion "pos <= m_rangeMax" failed at /tmp/pip-build-fSSxZu/wxPython/ext/wxWidgets/src/gtk/gauge.cpp(95) in SetValue(): invalid value in wxGauge::SetValue()

The windows version fills in the DICOM tree.

Not sure how best to diagnose this, some additional info: import wx wx.version() 4.0.3 gtk3 (phoenix) wxWidgets 3.0.5

dpkg -s libgtk-3-0|grep '^Version' Version: 3.22.30-1ubuntu1

I did have to do two extra things to get it to run on linux:

pip install PyPubSub==3.3.0     # rollback to latest version for py2
pip install matplotlib==2.1.0   # rollback before ImportError: cannot import name '_cntr' issue

this was after:

pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.3-cp37-cp37m-linux_x86_64.whl
pip install git+https://github.com/bastula/dicompyler

Thanks for any insight you can offer and the awesome project in general - it will be nice to have consistent viewing with team mates on the Mac and Windows!

c-amow avatar Nov 02 '18 15:11 c-amow

Thank you for reporting this. I will try to see if I can reproduce this issue in a linux VM.

I wonder if the issue is with the values sent to the progress bar or with wxPython/wxWidgets itself for GTK3.

The files you sent do work on the Mac version.

bastula avatar Nov 06 '18 17:11 bastula

I cloned the repo on Arch, install dependencies and can reproduce this issue. The prebuilt Windows binary (0.4.2) is okay.

I added this print(num, length, percentDone, message) in guiutil.py::OnUpdateProgress() right after percentDone is computed. Here is the log:

...
131 135 97 Processing DICOM data...
132 135 97 Processing DICOM data...
133 135 98 Processing DICOM data...
134 135 99 Processing DICOM data...
134 4 3350 Done

gaugeProgress.SetValue(percentDone) with 3350 is what causes the error. We should move the code for handling "Done" case prior to setting progress in guiutil.py::OnUpdateProgress(). I don't know why this works in the first place. There's no change in caller (treeview.py::RecurseTreeThread()).

leesei avatar Feb 26 '20 13:02 leesei

I now fix with this (rather then moving the code block):

        if not length:
            percentDone = 0
        else:
            # Fix #115, clip value
            percentDone = max(0, min(int(100 * (num) / length), 100))

leesei avatar Mar 02 '20 13:03 leesei