Synchronizing ROI in two Views

75 views
Skip to first unread message

Hauke Brunken

unread,
Feb 8, 2018, 9:57:20 AM2/8/18
to pyqtgraph
Hi,

I'm using Qt Designer for the layout where i have a graphicsLayoutWidget. I add two viewBoxes by:
self.viewBoxL = self.graphicsLayoutWidget.addViewBox(lockAspect=1.0,invertY=True, name='l')
self.viewBoxR = self.graphicsLayoutWidget.addViewBox(lockAspect=1.0,invertY=True, name='r')

self.imgItemL = pg.ImageItem(border='w')
self.imgItemR = pg.ImageItem(border='w')

self.viewBoxL.addItem(self.imgItemL)
self.viewBoxR.addItem(self.imgItemR)

self.viewBoxL.setXLink(self.viewBoxR)
self.viewBoxL.setYLink(self.viewBoxR)

self.imgItemL.setImage(imgL)
self.imgItemR.setImage(imgR)
which show two pictures of the same thing, but with different colors (I'm loading two different images with the same size). Now I want to add a ROI item. It seems that it is not possible to add this ROI item to both views, so I made two items and added them to viewBoxL and viewBoxR. Is it possible to synchronize these two items, so that every change I make in viewBoxL appears in viewBoxR?

Thanks for your help!
Hauke

jean Bilheux

unread,
Mar 22, 2018, 2:10:17 PM3/22/18
to pyqtgraph
I'm dealing with the exact same issue here. I will let you know if I can figure out how.

Hauke Brunken

unread,
May 9, 2018, 5:12:21 AM5/9/18
to pyqtgraph
I helped myself by synchronizing the ROIs by the setState and getState methods, which are called when a mouse drag is detected. It is not nice, but it works.
Reply all
Reply to author
Forward
0 new messages