VertexROIBase#

class glue.core.roi.VertexROIBase(vx=None, vy=None)[source]#

Bases: Roi

Class representing a set of vertices e.g. to define a 2D polygon.

Parameters:
vxfloat or array-like, optional

Initial x vertices.

vyfloat or array-like, optional

Initial y vertices.

Notes

This class only comprises the collection of vertices, but does not provide a contains method.

Methods Summary

add_point(x, y)

Add another vertex to the ROI.

defined()

Returns True if the ROI is defined

remove_point(x, y[, thresh])

Remove the vertex closest to a reference (x, y) point.

replace_last_point(x, y)

reset()

Reset the vertex lists and position angle

to_polygon()

Returns vertices vx, vy of a polygon approximating the Roi, where each is an array of vertex coordinates in x and y.

transformed([xfunc, yfunc])

A transformed version of the Roi

Methods Documentation

add_point(x, y)[source]#

Add another vertex to the ROI.

Parameters:
xfloat

The x coordinate of the point to add.

yfloat

The y coordinate of the point to add.

defined()[source]#

Returns True if the ROI is defined

remove_point(x, y, thresh=None)[source]#

Remove the vertex closest to a reference (x, y) point.

Parameters:
xfloat

The x coordinate of the reference point.

yfloat

The y coordinate of the reference point.

threshfloat, optional

Threshold. If set, the vertex closest to (x, y) will only be removed if the distance is less than thresh.

replace_last_point(x, y)[source]#
reset()[source]#

Reset the vertex lists and position angle

to_polygon()[source]#

Returns vertices vx, vy of a polygon approximating the Roi, where each is an array of vertex coordinates in x and y.

transformed(xfunc=None, yfunc=None)[source]#

A transformed version of the Roi