imellipse
(Not recommended) Create draggable ellipse
imellipse
is not recommended. Use the Ellipse
ROI
object instead. You can also use the ROI creation convenience function drawellipse
. If you used imellipse
to create a
circular ROI, use the Circle
ROI
object instead. For more information, see Version History.
Description
An imellipse
object encapsulates an interactive ellipse
over an image.
You can adjust the size and position of the ellipse by using the mouse. The ellipse also has a context menu that controls aspects of its appearance and behavior. For more information, see Usage.
Creation
Syntax
Description
h = imellipse
begins interactive placement of an ellipse
on the current axes, and returns an imellipse
object.
h = imellipse(
begins
interactive placement of an ellipse on the object specified by
hparent
)hparent
.
h = imellipse(___,"PositionConstraintFcn",
also specifies where the ellipse can be dragged using a position constraint
function, fcn
)fcn
.
Input Arguments
Properties
Usage
When you call imellipse
with an interactive syntax, the pointer
changes to a cross hairs when over an image. Click and drag the mouse to
specify the size and position of the ellipse. The ellipse also supports a context menu
that you can use to control aspects of its appearance and behavior. Right-click on the
ellipse to access this context menu.
The table lists the interactive behavior supported by
imellipse
.
Interactive Behavior | Description |
---|---|
Moving the entire ellipse. | Move the pointer inside the ellipse. The pointer changes to a fleur shape . Click and drag the mouse to move the ellipse. |
Resizing the ellipse. | Move the pointer over a resizing handle on the ellipse. The pointer changes to a double-ended arrow shape . Click and drag the mouse to resize the ellipse. |
Changing the color used to display the ellipse. | Move the pointer inside the ellipse. Right-click and select Set Color from the context menu. |
Retrieving the current position of the ellipse. | Move the pointer inside the ellipse. Right-click and select
Copy Position from the context menu.
imellipse copies a four-element position vector
[xmin ymin width height] to the
clipboard. |
Preserving the current aspect ratio of the ellipse during resizing. | Move the pointer inside the ellipse. Right-click and select Fix Aspect Ratio from the context menu. |
Deleting the ellipse | Move the pointer inside the ellipse. Right-click and select
Delete from the context menu. To remove
this option from the context menu, set the Deletable
property to false: h = imellipse(); h.Deletable =
false; |
Object Functions
Each imellipse
object supports a number of methods. Type
methods imellipse
to see a complete list.
addNewPositionCallback | Add new-position callback to ROI object |
createMask | (Not recommended) Create mask within image |
delete | Delete handle object |
getColor | Get color used to draw ROI object |
getPosition | Return current position of ROI object |
getPositionConstraintFcn | Return function handle to current position constraint function |
getVertices | Return vertices on perimeter of ellipse ROI object |
removeNewPositionCallback | Remove new-position callback from ROI object |
resume | (Not recommended) Resume execution of MATLAB command line |
setColor | (Not recommended) Set color used to draw ROI object |
setConstrainedPosition | Set ROI object to new position |
setFixedAspectRatioMode | Preserve aspect ratio when resizing ROI object |
setPosition | (Not recommended) Move ROI object to new position |
setPositionConstraintFcn | Set position constraint function of ROI object |
setResizable | Set resize behavior of ROI object |
wait | (Not recommended) Block MATLAB command line until ROI creation is finished |
Examples
Tips
If you use imellipse
with an axes that contains an image object,
and do not specify a position constraint function, users can drag the ellipse outside
the extent of the image and lose the ellipse. When used with an axes created by the
plot
function, the axes limits automatically expand to
accommodate the movement of the ellipse.