pyqtgraph color map (color bar) extremely slow at updating

49 views
Skip to first unread message

Kris McGrath

unread,
Sep 21, 2023, 9:47:06 AM9/21/23
to pyqtgraph

I am having trouble with a pyqtgraph w/ colorbar updating very slowly. I have created an app in PyQt5 that takes a bunch of images, does some math, and then displays the image in a pyqtgraph ImageView() w/ a colorbar.

When I change the colorbar bounds, it takes about 5-6 seconds to actually move the colorbar widget to where I dragged it to, then another 5-6 seconds to update the image.

Here is the code I use to display the image. I call "display_plot" from a pyqtSlot inside the UI thread, no issues with it freezing/shutting down, the UI thread should be handling the image display.

import pyqtgraph as pg from PyQt5 import QtWidgets class ImageWindow(QtWidgets.QWidget): def __init__(self): self.graph_widget = pg.ImageView() self.cmap = pg.colormap.get('CET-L9') vbox = QtWidgets.QVBoxLayout(self) vbox.addWidget(self.graph_widget) def display_plot(self, image): self.graph_widget.setImage(image) self.graph_widget.setColorMap(self.cmap)

The image is a 3200x3200 grayscale np-image.

Is there someway I can make this ImageView() update faster? Anything I'm doing very wrong?

Also, when you set the colorbar/image, does it create a thread that will handle updating the image? who updates the image in this?

Reply all
Reply to author
Forward
0 new messages