From ae4522109e2751f712bbfbcc0213fb6be7fb3f68 Mon Sep 17 00:00:00 2001 From: Toussaic Date: Tue, 27 Oct 2020 06:04:38 +0100 Subject: [PATCH] User-defined keywords of getArrayRegion (#1416) The three parameters "shape, vectors, origin" can't be passed as parameters because they are computed, which raise an error when kwds is passed to affineSlice. --- pyqtgraph/graphicsItems/ROI.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py index 1e4aa1e4..4f23ccd1 100644 --- a/pyqtgraph/graphicsItems/ROI.py +++ b/pyqtgraph/graphicsItems/ROI.py @@ -1162,7 +1162,14 @@ class ROI(GraphicsObject): # this is a hidden argument for internal use fromBR = kwds.pop('fromBoundingRect', False) - shape, vectors, origin = self.getAffineSliceParams(data, img, axes, fromBoundingRect=fromBR) + # Automaticaly compute missing parameters + _shape, _vectors, _origin = self.getAffineSliceParams(data, img, axes, fromBoundingRect=fromBR) + + # Replace them with user defined parameters if defined + shape = kwds.pop('shape', _shape) + vectors = kwds.pop('vectors', _vectors) + origin = kwds.pop('origin', _origin) + if not returnMappedCoords: rgn = fn.affineSlice(data, shape=shape, vectors=vectors, origin=origin, axes=axes, **kwds) return rgn