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.
With the new ROIs, you use the DrawingArea
property of the ROI to
specify the area in which you can draw or move an ROI.
Update CodeUpdate all instances of makeConstrainToRectFcn
.
Discouraged Usage | Recommended Replacement |
---|
This example uses the makeConstrainToRectFcn
function to create a function that limits the area in which you can
create or move an ROI to the size of the underlying image. By default,
you can move an ROI off the image
area. | Here is equivalent code, replacing use of
makeConstrainToRectFcn function with the
DrawingArea property of the ROI. By default, the
new ROIs limit their creation and movement to the size of the
underlying image, so there is no need to recreate that part of the
example. Instead, this example creates a 10-pixel margin inside the
image boundary where the ROI cannot
go. |