Create customizable cuboidal ROI
creates a
roi
= drawcuboidCuboid
ROI object and enables interactive drawing of a cuboidal region
of interest (ROI) on the current axes.
To draw the ROI, call the drawcuboid
function. The function draws a
cuboidal ROI, centered in the volume. Move the pointer onto the image. The cursor changes to
a fleur shape. Move the ROI anywhere on the image. To finish the ROI, click the mouse
button. For more information about using the ROI, including keyboard shortcuts and context
menu options, see Tips.
Note
drawcuboid
is a convenience function for creating a
Cuboid
ROI object. If you create the ROI object directly, calling
Cuboid
, you
must call the draw
object function to enable interactive drawing of
the ROI. In contrast, the drawcuboid
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 of the ROI using one or more name-value pairs.roi
= drawcuboid(___,Name,Value
)
The ROI supports the following interactivity, including keyboard shortcuts.
Behavior | Keyboard shortcut |
---|---|
Fine-tune ROI size while drawing. | Use the scroll wheel to make small changes to the size of the ROI while drawing. |
Stop drawing the ROI. | Press Esc. The function returns a valid ROI object with an
empty Position field. |
Resize (reshape) the ROI. | Position the pointer on one of the visible faces of the cuboid and click and drag the surface. You might have to rotate the cuboid to select a surface. If you press the Shift, dragging the mouse moves the ROI but does not change any of the dimensions. |
Move the ROI. | Position the pointer on any of the visible surfaces of the ROI and click and drag while pressing Shift. Position the pointer on any visible surface of the ROI, right-click, and select Lock Dimensions. 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 Cuboid from the menu. You can also delete
the ROI using the delete object function. |
The drawcuboid
function returns a Cuboid
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 Cuboid
object, see
Set Up Listener for Cuboid ROI Events. For more details
about these capabilities, see the Cuboid
object
documentation.
Cuboid
| drawassisted
| drawcircle
| drawcrosshair
| drawellipse
| drawfreehand
| drawline
| drawpoint
| drawpolygon
| drawpolyline
| drawrectangle