Image View custom ROI plot

58 views
Skip to first unread message

Jason Bylsma

unread,
Feb 4, 2019, 9:21:54 PM2/4/19
to pyqtgraph
I am working with sets of 6-band imagery and I am so far able to load custom datasets as numpy arrays into a pg.ImageView window and use the built-in ROI tools to evaluate each band in a "timeline" of 6 images. I would like to customize the ImageView window in the following ways:
  1. real-time readout of numeric values based on cursor position on each image in the timeline (e.g. 6 numeric values above the image that update as the cursor moves around the image)
  2. custom ROI plot as a static bar & whiskers plot item displaying mean, min, max, 75th and 25th percentile from within the region, for each of the six "bands" in the timeline (I already have the plots in a matplotlib instantiation so it may be simplest to pull that into the ROI plot area
  3. (alternate to 2) In the short-term I'm finding that the roiCurve in the ImageView example makes it hard to read data values. How could I add simple data labels at each point on the roiCurve?
Any guidance on these customizations would be appreciated. It looks like once I instantiate a pg.ImageView window, it becomes difficult to customize subsections, though I can successfully load in the 6-image set and use the ROI tool.

Patrick

unread,
Feb 5, 2019, 9:25:09 PM2/5/19
to pyqtgraph
Hi,

The problem with ImageView is that I'd consider it really an example Qt Widget/application built using pyqtgraph components, rather than a pyqtgraph widget, which makes building off that somewhat awkward. I'd suggest just copying the ImageView.py (and .ui template etc) and modifying your own version of it to build the functionality you want. This way you can add ui elements or remove things you don't need etc.

As for your desired features:
1. See the "Crosshair / Mouse interaction" example, which I think is very close to what you want.
2. If you do as suggested above and build your own custom ImageView, then modifying the appearance of the ROI plot is easily possible. Yes you could embed a matplotlib window, but for consistency/performance I'd just try to re-make it in pyqtgraph.
3. I answered a similar question with some basic code here (https://groups.google.com/d/msg/pyqtgraph/V01QJKvrUio/PhplrzR2CQAJ). It's probably good enough already if you're not planning on adding/removing handles to the ROI.

Hope that helps,
Patrick
Reply all
Reply to author
Forward
0 new messages