I've encountered an interesting effect of using ImageItem setImage and
setRect:
In a loop I want to continually update an the image in ImageItem with new
image data. Psuedocode follows:
img_rect = QtCore.QRectF(x0, y0, w, h)
img_item.setRect(img_rect)
for x in range(100):
img_item.setImage(img_data[x,:,:])
If the image_data has non-square pixels, each setImage will create a
bounding box that starts at x0, y0, but will not have the correct width, ie
it will be 2x wider if pixel aspect ratio is 2:1.
The fix that I had was to repeatedly setRect after each setImage:
img_rect = QtCore.QRectF(x0, y0, w, h)
img_item.setRect(img_rect)
for x in range(100):
img_item.setImage(img_data[x,:,:])
img_item.setRect(img_rect)
While this works, the behavior seems unexpected and undocumented. Should
the current behavior be considered correct? If so it should be documented.
If not where should we make the correction, I haven't dug into the
ImageItem code to discover how hard a fix this would be. I am happy to
explore with some guidance.
Thanks!
-Ed
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/698342cc-6980-4b85-b33d-0ae24c4bbd06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.