Ellipse
R2026bElliptical region of interest
Description
An Ellipse object specifies the shape and position of an
axes-based elliptical region of interest (ROI). You can customize the appearance and
interactive behavior of the ROI.
Axes-based ROIs enable you to draw and edit regions of interest
on images displayed using imshow or in MATLAB® axes. Axes-based ROIs offer maximum customization of appearance and behavior,
including line width, marker style, and edge color. Use axes-based ROIs for fine-grained control
over ROI appearance, integration with existing axes-based apps, or access to the assisted
freehand, crosshair, or cuboid ROI types. For a comparison of axes-based ROIs with other ROIs,
see Choose Approach to Annotate ROIs in Images.

For more information about using this ROI, including keyboard shortcuts, see Tips.
Creation
There are two ways to create an Ellipse object. For more information, see
Create Axes-Based ROIs.
Use the
drawellipsefunction. Use this function when you want to create the ROI and set the appearance in a single command. You can specify the shape and position of the ROI interactively by drawing the ROI over an image using the mouse, or programmatically by using name-value arguments.Use the
images.roi.Ellipsefunction described here. Use this function when you want to specify the appearance and behavior of the ROI before you specify the shape and position of the ROI. After creating the object, you can specify the shape and position interactively by using thedrawfunction or programmatically by modifying properties of the object.
Description
creates an
roi = images.roi.EllipseEllipse object with default property values.
creates the ROI on the axes specified by roi = images.roi.Ellipse(ax)ax.
sets writeable properties of the
ROI using one or more name-value arguments.roi = images.roi.Ellipse(___,Name=Value)
Example: images.roi.Ellipse(Color="y") creates a yellow colored
Ellipse object.
Input Arguments
Properties
Object Functions
addlistener | Create event listener bound to event source |
beginDrawingFromPoint | Begin drawing ROI from specified point |
bringToFront | Bring ROI to front of Axes stacking order |
createMask | Create binary mask image from ROI |
draw | Begin drawing ROI interactively |
inROI | Query if points are located in ROI |
wait | Block MATLAB command line until ROI operation is finished |
Examples
More About
Tips
To draw the ROI interactively using the
drawordrawellipsefunction, position the cursor on the axes and click and drag to create the shape. To finish the ROI, release the mouse button.The ROI supports the following interactivity, including keyboard shortcuts.
Behavior Keyboard shortcut Cancel drawing the ROI. Press Esc. The function returns a valid ROI object with an empty Positionproperty.Fine-tune width of ellipse as you are drawing. As you draw the ellipse, use the scroll wheel to make small changes to the width of the ellipse. Rotate the ROI. Position the pointer near a vertex. The pointer changes to the rotate pointer. Click and rotate the ROI on its center.
To make the rotation snap at 15 degree angles, press Shift as you rotate.
Maintain aspect ratio while drawing. Hold the Shift key as you draw. Creates a circular ROI.
To lock the aspect ratio, position the pointer on the ROI, right-click, and select Fix Aspect Ratio from the context menu
Resize (reshape) the ROI. Position pointer over a vertex and then click and drag. To main the aspect ratio as you resize, hold the Shift key.
Move the ROI. Position the pointer over the ROI. The pointer changes to the fleur shape. Click and drag to move the ROI. Delete the ROI. Position the pointer anywhere in the ROI and right-click. Select Delete Ellipse from the context menu. You can also delete the ROI programmatically using the deletefunction.To draw a circular ROI, use the
Circleobject.


