ROI

class pyqtgraph.ROI(pos, size=Point(1.000000, 1.000000), angle=0.0, invertible=False, maxBounds=None, snapSize=1.0, scaleSnap=False, translateSnap=False, rotateSnap=False, parent=None, pen=None, movable=True)

Generic region-of-interest widget. Can be used for implementing many types of selection box with rotate/translate/scale handles.

__init__(pos, size=Point(1.000000, 1.000000), angle=0.0, invertible=False, maxBounds=None, snapSize=1.0, scaleSnap=False, translateSnap=False, rotateSnap=False, parent=None, pen=None, movable=True)
getArrayRegion(data, img, axes=(0, 1))

Use the position of this ROI relative to an imageItem to pull a slice from an array.

getArraySlice(data, img, axes=(0, 1), returnSlice=True)

Return a tuple of slice objects that can be used to slice the region from data covered by this ROI. Also returns the transform which maps the ROI into data coordinates.

If returnSlice is set to False, the function returns a pair of tuples with the values that would have been used to generate the slice objects. ((ax0Start, ax0Stop), (ax1Start, ax1Stop))

getGlobalTransform(relativeTo=None)

Return global transformation (rotation angle+translation) required to move from relative state to current state. If relative state isn’t specified, then we use the state of the ROI when mouse is pressed.

getLocalHandlePositions(index=None)

Returns the position of a handle in ROI coordinates

handleChange()

The state of the ROI has changed; redraw if needed.

saveState()

Return the state of the widget in a format suitable for storing to disk.

translate(*args, **kargs)

accepts either (x, y, snap) or ([x,y], snap) as arguments

snap can be:
None (default): use self.translateSnap and self.snapSize to determine whether/how to snap False: do no snap Point(w,h) snap to rectangular grid with spacing (w,h) True: snap using self.snapSize (and ignoring self.translateSnap)

Previous topic

InfiniteLine

Next topic

GraphicsLayout

This Page