Line
Line region of interest
Description
A Line
object specifies the length and position of a linear
region-of-interest (ROI). You can customize the appearance and interactive behavior of the
ROI.
For more information about using this ROI, including keyboard shortcuts, see Tips.
Creation
There are two ways to create a Line
object. For more information, see
Create ROI Shapes.
Use the
drawline
function. Use this function when you want to create the ROI and set the appearance in a single command. You can specify the length 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.Line
function described here. Use this function when you want to specify the appearance and behavior of the ROI before you specify the length and position of the ROI. After creating the object, you can specify the length and position interactively by using thedraw
function or programmatically by modifying properties of the object.
Description
creates a
roi
= images.roi.LineLine
object with default properties.
creates the ROI on the axes specified by roi
= images.roi.Line(ax
)ax
.
sets properties of the
ROI using name-value arguments. You can specify multiple name-value arguments.roi
= images.roi.Line(___,PropertyName=Value
)
Example: images.roi.Line(Color="y")
creates a yellow colored
Line
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 |
wait | Block MATLAB command line until ROI operation is finished |
Examples
More About
Tips
To draw the ROI interactively using the
draw
ordrawline
function, position the cursor on the axes and click and drag to draw the ROI shape. To finish the ROI, release the mouse button.The ROI supports the following interactivity, including keyboard shortcuts.
Behavior Keyboard shortcut Make drawn line snap to 15 degree angles. Hold the Shift key while drawing. Cancel drawing the ROI. Press Esc. The function returns a valid ROI object with an empty Position
property.Resize the ROI. Position pointer over either endpoint and then click and drag to resize the ROI. Hold the Shift key while resizing to snap the line drawn at 15 degree angles.
Move the ROI. Position the pointer over the ROI. The pointer changes to the fleur shape. Then click and drag the ROI. For information about using an ROI in an app created with App Designer, see Using ROIs in Apps Created with App Designer.