Bring ROI to front of Axes stacking order



bringToFront(ROI) moves the specified ROI to the front of the front-to-back visual stacking order of Axes children.

Use the bringToFront method when you want to bring a single ROI to the front of the visual stacking order. For other restacking behaviors, use the uistack function.


expand all

Read an image into the workspace and display it.

I = imread('coins.png');

Create a circular ROI on the image, specifying where you want to place the circle and how wide to make the circle. To make it easy to see the changes to the stacking order, make the ROI opaque and specify the color black.

roi = images.roi.Circle(gca,'Center',[166 123],'Radius',50);
roi.FaceAlpha = 1.0;
roi.Color = 'black';

Create another circular ROI, specifying the same center point but make this ROI bigger. Again, to make the stacking order easy to see, make the ROI opaque and specify a different color, in this case, blue. This new ROI completely covers the first ROI.

roi2 = images.roi.Circle(gca,'Center',[166 123],'Radius',100);
roi2.FaceAlpha = 1.0;
roi2.Color = 'blue';

Bring the original ROI to the front by using the bringToFront function.


Input Arguments

expand all

Region of interest, specified as an ROI object of one of the following types:

Introduced in R2019a