Starting in R2018b, a new set of ROI objects replaces the existing set of ROI objects. The new objects provide more functional capabilities, such as face color transparency. The new classes also support events that you can use to respond to changes in your ROI such as moving or being clicked. Although there are no plans to remove the old ROI objects at this time, switch to the new ROIs to take advantage of the additional capabilities and flexibility. For more information on creating ROIs using the new ROI functions, see ROI Creation Overview.
In the existing ROIs, you can control whether a hand-drawn shape or a polygonal
shape are closed or open. By default, when you double-click to draw the final vertex
of one of these shapes, the ROI draws a line between the last vertex and the first
vertex to close the shape. Using the setClosed
method, you can
create an open hand-drawn shape or polyline. With the new ROIs, the
Freehand
and AssistedFreehand
shapes
support a Closed
property that you can use to specify whether the
shape is closed or open. The new ROIs support both a polygon (closed) and a polyline
(open) shape, so there is no need for these ROIs to support a
Closed
property.
Update CodeUpdate all instances of setClosed
.
Discouraged Usage | Recommended Replacement |
---|
This example creates a polygonal ROI and uses the
setClosed method to turn the closed
polygon into an open
polyline. | To create an open polyline ROI, replace the call to the
impoly with
drawpolyline (or
thePolyline object). Use
drawpolygon (or the
Polygon object) to create a closed
polygonal
shape. |
This example creates a hand-drawn ROI and uses the
setClosed method to turn the closed
shape into an open
shape. | To create an open, hand-drawn ROI shape, replace the
call to imfreehand with
drawfreehand or
drawassisted . You can also create
Freehand or
AssistedFreehand objects. Use the
Closed property to turn the closed
shape into an open shape.
|