Suppose you have a rectangular pyqtgraph roi instance with some data:
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
data = np.random.random(size=(50,50,50))
app = QtGui.QApplication([])
w = pg.ImageView()
roi = pg.RectROI([20, 20], [20, 20], pen=(0,9))
roi.addRotateHandle([1, 0], [0.5, 0.5])
w.setImage(data)
w.addItem(roi)
w.show()
How can I extract the 4 corner coordinates of the roi after scaling/rotating it? It think it is possible to calculate them trigonometrically after calling
pos_x, pos_y = roi.pos()
angle = roi.angle()
size_x, size_y = roi.size()
However, it is not that straight forward since the angle can take values >360° etc. I feel like I have missed some build-in solution.