Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Insanely slow updating of pyqtgraph when changing colorbar bounds

Insanely slow updating of pyqtgraph when changing colorbar bounds

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 719 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kgenbio
    wrote on last edited by kgenbio
    #1

    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?

    C 1 Reply Last reply
    0
    • K kgenbio

      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?

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @kgenbio You'd have to ask the PyQtGraph project how their processing works internally. I assume that the "colorbar widget" is part of the ImageView.

      I have not used the library, but it looks to me that setColorMap() needs on be called once at ImageView setup. If you do that does it make a difference?

      K 1 Reply Last reply
      0
      • C ChrisW67

        @kgenbio You'd have to ask the PyQtGraph project how their processing works internally. I assume that the "colorbar widget" is part of the ImageView.

        I have not used the library, but it looks to me that setColorMap() needs on be called once at ImageView setup. If you do that does it make a difference?

        K Offline
        K Offline
        kgenbio
        wrote on last edited by
        #3

        @ChrisW67 good point on setting it once. I posted on the pyqtgraph google group, thanks for the suggestion!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved