Main Content

bringToFront

Bring ROI to front of Axes stacking order

Since R2019a

Description

example

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

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

Examples

collapse all

Read an image into the workspace and display it.

I = imread('coins.png');
imshow(I)

Figure contains an axes object. The axes object contains an object of type image.

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';

Figure contains an axes object. The axes object contains 2 objects of type image, images.roi.circle.

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';

Figure contains an axes object. The axes object contains 3 objects of type image, images.roi.circle.

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

bringToFront(roi)

Figure contains an axes object. The axes object contains 3 objects of type image, images.roi.circle.

Input Arguments

collapse all

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

Version History

Introduced in R2019a