Create customizable elliptical ROI
creates an
roi
= drawellipseEllipse
object and enables interactive drawing of an
elliptical region-of-interest (ROI) on the current axes.
To draw the ROI, position the pointer on the image. The cursor changes to a fleur shape. Click and drag to draw the elliptical ROI. To finish the ROI, release the mouse button. For more information about using the ROI, including keyboard shortcuts and context menu options, see Tips.
Note
drawellipse
is a convenience function for creating an
Ellipse
ROI object. If you create the ROI object
directly, calling Ellipse
, you must call the draw
object
function to enable interactive drawing of the ROI. In contrast, the
drawellipse
function creates the ROI object and calls
the draw
object function for you. Whichever way you
create the ROI, you use object properties, object functions, and event
notifications to customize its appearance and behavior. For more information
about using these capabilities, see Tips.
modifies the appearance and behavior of the ROI using one or more name-value pairs.
Unspecified name-value pairs are set to the default value.roi
= drawellipse(___,Name,Value
)
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 Position field. |
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 over the ROI and right-click to view its
context menu. Select Delete Ellipse
from the menu. You can also delete the ROI using the
delete object function. |
The
drawellipse
function returns an Ellipse
ROI object. After creation, use these capabilities of the
object to customize the appearance and behavior of the ROI.
Object properties — ROI objects support properties that modify their appearance or behavior. For example, to change the color of the roi
to yellow, set its Color
property, roi.Color = 'yellow'
.
Object functions — ROI objects support a set of object functions that operate on the ROIs. For example, if you want to pause the MATLAB command line after creating an ROI, call the wait
object function.
Event notifications — ROI objects can notify your code when certain events, such as being moved or clicked, happen to the ROI. To receive these notifications, use the addlistener
object function to set up listeners for specific events. In the listener, specify an event, such as 'ROIMoved'
, and a callback function that executes when the event occurs. When the ROI notifies your application through the listener, it returns data specific to the event. For example, with the 'ROIMoved'
event, the ROI object returns its previous position and its current position.
For an example of using event listeners with the Ellipse
object, see Set Up Listener for Ellipse ROI Events. For more
details about these capabilities, see the Ellipse
object documentation.
drawassisted
| drawcircle
| drawcrosshair
| drawcuboid
| drawfreehand
| drawline
| drawpoint
| drawpolygon
| drawpolyline
| drawrectangle
| Ellipse