Line
Description
A Line object labels lines in a Viewer object.
The properties of the object control the appearance and behavior of the line
annotation.
Viewer-based ROIs provide high-performance interactions with images and volumes you
display in a Viewer object using imageshow and
volshow, respectively. To draw a line on an imshow
image display, use drawline
instead.
![]()
Creation
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
uidrawandimages.ui.graphics.roi.Linefunctions create ROIs to display in aViewerobject. Viewer-based ROIs provide high-performance interactions with images and volumes you display in aViewerobject usingimageshowandvolshow, respectively. To draw a line on animshowimage display, usedrawlineinstead.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.

