RectangularROI#
- class glue.core.roi.RectangularROI(xmin=None, xmax=None, ymin=None, ymax=None, theta=None)[source]#
Bases:
Roi
A 2D rectangular region of interest.
- Parameters:
- xmin, xmaxfloat, optional
x coordinates of left and right edge.
- ymin, ymaxfloat, optional
y coordinates of lower and upper edge.
- thetafloat, optional
Angle of anticlockwise rotation around center in radian.
Notes
The input and
update_limits()
parameters specify the x and y edge positions before any rotation is applied; the size always remains \(width\) = xmax - xmin; height = ymax - ymin.Methods Summary
center
()Return the (x, y) coordinates of the ROI center
contains
(x, y)Test which of a set of (x, y) points fall within the region of interest.
corner
()defined
()Returns True if the ROI is defined
height
()move_to
(x, y)Translate the ROI to a center of (x, y)
reset
()Reset the rectangular region
rotate_to
(theta)Rotate anticlockwise around center to position angle theta.
Returns vertices vx, vy of the rectangular region represented as a polygon, where each is an array of vertex coordinates in x and y.
transformed
([xfunc, yfunc])A transformed version of the Roi
transpose
([copy])update_limits
(xmin, ymin, xmax, ymax)Update the limits (edge positions) of the rectangle before rotation
width
()Methods Documentation
- contains(x, y)[source]#
Test which of a set of (x, y) points fall within the region of interest.
- Parameters:
- xfloat or array-like
x coordinate(s) of point(s).
- yfloat or array-like
y coordinate(s) of point(s).
- Returns:
- insidebool or ~numpy.ndarray
An boolean iterable, where each element is True if the corresponding (x, y) tuple is inside the Roi.
- Raises:
- UndefinedROI
If not defined.
- rotate_to(theta)[source]#
Rotate anticlockwise around center to position angle theta.
- Parameters:
- thetafloat
Angle of anticlockwise rotation around center in radian.
- to_polygon()[source]#
Returns vertices vx, vy of the rectangular region represented as a polygon, where each is an array of vertex coordinates in x and y.