ImageView with 4 rois and 4 roiplots

40 views
Skip to first unread message

Bobby Henley

unread,
Oct 2, 2015, 5:23:18 PM10/2/15
to pyqtgraph
Hi everyone,

I think I have a fairly simple question, if I wanted to repurpose the ImageView widget so that when one presses the ROI button, instead of an ROI and a ROI plot appearing, 4 of each appeared, how would I go about doing this?

Vincent Le Saux

unread,
Oct 13, 2015, 6:49:33 AM10/13/15
to pyqtgraph
Hi Bobby,

Just look at the ImageView source code, you will have the answer. The interesting lines are:
1. creation of the ROI
    self.roi = PlotROI(10)

    self.roi.setZValue(20)
    self.view.addItem(self.roi)

2. creation of the plotDataItem
    self.roiCurve = self.ui.roiPlot.plot()

3. connection of the ROI to its data in the PlotWidget
   self.roi.sigRegionChanged.connect(self.roiChanged)

What you could do is to consider not a single ROI but rather a list of ROI that could be connected to a list of PlotDataItem through the signal sigRegionChanged. The best way to do so is to subclass ImageView. That should be quite simple to do. Let us know if you face some troubles coding it!

Regards,

Vincent
Reply all
Reply to author
Forward
0 new messages