Line
R2026bDescription
A Line object labels interactive lines in a
Viewer object. The properties of the object control the appearance and
behavior of the line annotation.
Interactive viewer-based ROIs enable you to draw, edit, and
measure regions of interest on images and volumes displayed using imageshow
and volshow. Interactive ROIs support dragging, resizing, event callbacks,
and measurement labels. Use interactive viewer-based ROIs to manually annotate an image, build
annotation workflows in apps, or respond to user interactions with ROI shapes. For a comparison
of interactive viewer-based ROIs with other ROIs, see Choose Approach to Annotate ROIs in Images.
![]()
Creation
You can create a Line object in these ways. For more information, see
Create Interactive Viewer-Based ROIs.
Interactively draw a line in a
Viewerobject. From the viewer toolbar, select the draw annotations icon
, then select the draw line icon
. Click the image to place the first endpoint, drag to
draw the line, and release to place the second endpoint. To export the line to the
workspace as a Lineobject, right-click the ROI and select Export annotation to workspace.Use the
uidrawfunction to interactively draw the ROI in a specified viewer and create the ROI object.Use the
images.ui.graphics.roi.Linefunction described here. After you create the ROI, you can display it by adding the object to theAnnotationsproperty of aViewerobject.
Description
l = images.ui.graphics.roi.Line creates a Line
object with default property values. Use l to query and modify
properties of the Line object after you create it.
l = images.ui.graphics.roi.Line(Name=Value) sets one or more
writable properties using name-value
arguments.
Example: images.ui.graphics.roi.Line(Position=[35 3 1010; 40 80
1080]) creates a line annotation with endpoints at the
xyz-coordinates (35, 3, 1010) and (40, 80, 1080).
Properties
Object Functions
createMask | Create binary mask image from ROI |
Examples
Tips
The
Lineobject supports these forms of interactivity.Behavior Interaction Add annotation From the viewer toolbar, select the draw annotations icon
, then select the draw line icon
. Click to place the first endpoint, drag to
draw the line, and release to place the second endpoint.Make drawn line snap at 15 degree angles Hold Shift while drawing. Move annotation To reposition one endpoint, drag the endpoint.
To reposition the whole line, including both endpoints, drag the line or hold Ctrl while you drag one of the endpoints.
Edit annotation label Right-click the line. From the context menu, select Edit label. When the label text highlights, type new text for the label. To finish editing, click outside the label. Remove annotation Right-click the line. From the context menu, select Remove annotation to remove the selected annotation. Select Remove all annotations to remove all annotations in the viewer. When placing annotations, consider zooming in or, for 3-D viewers, snapping to an orthogonal view for greater spatial accuracy. Zoom in using the scroll wheel or by selecting the zoom icon
from the viewer toolbar. Snap to an orthogonal view by
clicking the orientation axes labels in the lower-left corner of the viewer.

