Polygonal region of interest
The Polygon
object is a polygonal region-of-interest
(ROI).
To draw the ROI, position the cursor on the axes, click and drag the pointer to create the
shape. As you draw the line, click to create a vertex. Double-click to finish drawing and
close the polygon. For more information about using this ROI, including keyboard shortcuts,
see Tips
.
To create a Polygon
object, use the
images.roi.Polygon
creation function. After creating the object, call
the draw
object
function to begin drawing. As a convenience, you can also use the drawpolygon
function to create a Polygon
ROI. The drawpolygon
function creates the ROI object and automatically calls the draw
object
function.
creates an instance
of the roi
= images.roi.Polygonimages.roi.Polygon
object with default properties.
creates the ROI in the axes specified by roi
= images.roi.Polygon(ax
)ax
.
sets
properties using
name-value pairs. For example, roi
= images.roi.Polygon(___,Name,Value
)images.roi.Polygon('Color','y')
sets the
color of the Polygon
object to yellow. You can specify multiple
name-value pairs. Enclose each property name in single quotes.
addlistener | Create event listener bound to event source |
beginDrawingFromPoint | Begin drawing ROI from specified point |
bringToFront | Bring ROI to front of Axes stacking order |
createMask | Create binary mask image from ROI |
draw | Begin drawing ROI interactively |
inROI | Query if points are located in ROI |
reduce | Reduce density of points in ROI |
wait | Block MATLAB command line until ROI operation is finished |
The ROI supports the following interactivity, including keyboard shortcuts.
Behavior | Keyboard shortcut |
---|---|
Make drawn line snap at 15 degree angles. | Hold the Shift key while drawing. |
Finish drawing (close) the ROI. | Double-click, which adds a new vertex at the pointer position and draws a line to the first vertex to close the polygon. Press Enter, which adds a new vertex at the pointer position and draws a line to the first vertex to close the polygon. Right-click, which does not add a new vertex but closes the polygon from the previous vertex. Position pointer over the first vertex and click. |
Cancel drawing the ROI. | Press Esc. The function returns a valid ROI object with an
empty Position field. |
Add a new vertex to the ROI. | Position the pointer over the edge of the ROI and double-click. Position the pointer over the edge of the ROI, right-click, and select Add Vertex from the context menu. |
Remove the most recently added vertex but keep drawing. | Press Backspace. The function redraws the line from the previous vertex to the current position of the pointer. You can only back up to the first vertex you drew. |
Resize (reshape) the ROI | Position pointer over a vertex and then click and drag. Add a new vertex to the polygon and then click and drag. Remove a vertex. The ROI redraws the line connecting the two neighboring vertices. |
Move the ROI. | Position the pointer over the ROI. Hover over the edge of the polygon (not on a vertex). The pointer changes to the fleur shape. Click and drag to move the ROI. |
Delete the ROI. | Position the pointer on the ROI, right-click, and choose Delete
Polygon from the context menu. You can also delete the ROI
programmatically using the delete object method. |
For information about using an ROI in an app created with App Designer, see Using ROIs in Apps Created with App Designer.
AssistedFreehand
| Circle
| Crosshair
| Cuboid
| drawpolygon
| Ellipse
| Freehand
| Line
| Point
| Polyline
| Rectangle