Skip to content

Intermittent exception thrown trying to update ImageItem #3138

@bryaan

Description

@bryaan

I am seeing the following stacktrace with pyqqgraph (latest version).
Forgive me for not posting the code, I can't get an MRE to reproduce it right now.

It happens intermittently when setting an image for ImageItem.
Only happens when autoDownsample=True


Exception caught:
Type: <class 'IndexError'>
Value: index 207 is out of bounds for axis 0 with size 200
Traceback:
Traceback (most recent call last):
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/widgets/GraphicsView.py", line 137, in paintEvent
    return super().paintEvent(ev)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/graphicsItems/ImageItem.py", line 616, in paint
    self.render()
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/graphicsItems/ImageItem.py", line 590, in render
    qimage = functions_qimage.try_make_qimage(image, levels=levels, lut=lut, transparentLocations=self._imageNanLocations)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/functions_qimage.py", line 289, in try_make_qimage
    image[..., 3][transparentLocations] = 0
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
IndexError: index 207 is out of bounds for axis 0 with size 200

Traceback (most recent call last):
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/widgets/GraphicsView.py", line 137, in paintEvent
    return super().paintEvent(ev)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/graphicsItems/ImageItem.py", line 616, in paint
    self.render()
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/graphicsItems/ImageItem.py", line 590, in render
    qimage = functions_qimage.try_make_qimage(image, levels=levels, lut=lut, transparentLocations=self._imageNanLocations)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bryan/Library/Caches/pypoetry/virtualenvs/tibrapy-kSCdRiAR-py3.12/lib/python3.12/site-packages/pyqtgraph/functions_qimage.py", line 289, in try_make_qimage
    image[..., 3][transparentLocations] = 0
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions