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 Create ROI Shapes.
In the existing ROIs, you can create a function that controls where you can draw
or move an ROI. You then register the position constraint function with the ROI. To
specify the area when you can draw or move an ROI, use the
DrawingArea
property.
Update CodeUpdate all instances of setPositionConstraintFcn
used
with the freehand or polygonal ROI.
Discouraged Usage | Recommended Replacement |
---|
This example creates a point ROI and uses the
setPositionConstraintFcn method to
confine ROI creation and movement to within the boundaries
of the underlying
image. | Create one of the new ROI objects and use the
DrawingArea property to specify the
limits where you can create or move an ROI. For example,
this code creates a 10 pixel margin inside the image
boundary. |