Hi,
first of all I would like to thank all contributors for their efforts, I'm impressed by the speed of pyqtgraph's examples and really interested to try some of its features in my application.
In my existing PySide application I display a live image from a camera as a QGraphicsPixmapItem in a QGraphicsScene. Now, I want to display some overlays (sharpness measure etc.) on top of this item using pyqtgraph. A simple plot of a grid of crosses is already working using the following code (excerpt is taken from a class method and cannot be executed on its own):
from matplotlib import cm
import pyqtgraph as pq
# [...]
# just the plotting part:
plot_item = pg.PlotItem()
# These are lists of values
x, y, sharpness_values = sharpness.sharpness_grid_to_arrays(
self._sharpness_grid)
colormap = cm.get_cmap("RdYlGn")
marker_colors = colormap(sharpness_values)
color_tuples = []
for color in marker_colors:
color = color * 255.
# Each color is a list: [R, G, B, A]
color_tuples.append(tuple(color))
plot = plot_item.plot(x=x, y=y, pen=None, symbol='+', symbolSize=10,
symbolPen=color_tuples)
# Method is called periodically for every image, keep track of plots
# and remove them using self._scene.removeItem(...)
self._plot_items.append(plot)
# self._scene is a PySide.QtGui.QGraphicsScene object
self._scene.addItem(plot)
This works and displays the plot just fine. However, I receive the following error after each update of the plot:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pyqtgraph\graphicsItems\GraphicsObject.py", line 19, in itemChange
self._updateView()
File "C:\Python27\lib\site-packages\pyqtgraph\graphicsItems\GraphicsItem.py", line 382, in _updateView
view.sigRangeChanged.connect(self.viewRangeChanged)
AttributeError: 'GraphicsView' object has no attribute 'sigRangeChanged'
I think this might be caused by the fact, that I don't use pyqtgraph.ViewBox as a container. Does anybody have any experience on how to combine a PySide QGraphicsScene and pyqtgraph plots? Should I integrate my QGraphicsPixmapItem into a pyqtgraph.GraphicsScene?
I would prefer to stick with the PySide QGraphicsScene as we already have written some UI code for region selection and I'm not sure if the view code will work with pyqtgraph's objects without modification. Later, we could migrate to pyqtgraph's ROI objects but first I want to evaluate the plot possibilities and processing speed in some real applications.
Another thing that I would like to integrate is a grid as in the example "ROIExamples.py" (bottom right corner), but I don't know which object to create and add to my scene.
Any pointers or suggestions are appreciated.
Thanks in advance and best regards
Joschka