Rectangular region of interest
The Rectangle
object is a rectangular region-of-interest (ROI).
To draw the ROI, position the cursor on the axes and click and drag to create the shape. To finish the ROI, release the mouse button. For more information about using this ROI, including keyboard shortcuts, see Tips.
To create a Rectangle
object, use the
images.roi.Rectangle
creation function. After creating the object, call
the draw
object
function to begin drawing the ROI. As a convenience, you can also use the drawrectangle
function to create a Rectangle
ROI. The drawrectangle
function creates the ROI object and automatically calls the draw
object
function.
creates an
instance of the roi
= images.roi.Rectangleimages.roi.Rectangle
class with default
properties.
creates an ROI in the axes specified by roi
= images.roi.Rectangle(ax
)ax
.
sets properties using name-value
pairs. For example, roi
= images.roi.Rectangle(___,Name,Value
)images.roi.Rectangle('Color','y')
sets the color of
the Rectangle
object to yellow. You can specify multiple name-value
pairs. Enclose each property name in single quotes.
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 |
inROI | Query if points are located in ROI |
wait | Block MATLAB command line until ROI operation is finished |
The ROI supports the following interactivity, including keyboard shortcuts.
Behavior | Keyboard shortcut |
---|---|
Cancel drawing the ROI. | Press Esc. The function returns a valid ROI object with an
empty Position field. |
Resize (reshape) the ROI. | Position the cursor over a vertex and then click and drag. The rectangle has vertices at each corner and at the midpoint of each side. To preserve the aspect ratio while resizing, press the Shift key. To lock the aspect ratio, use the Fix Aspect Ratio in the right-click context menu. |
Move the ROI. | Position the cursor over the ROI. The cursor changes to the fleur shape. Click and drag the ROI. |
Delete the ROI. | Position the pointer on the rectangle, right-click, and choose
Delete Rectangle from the context menu. You can also
delete the ROI programmatically using the delete object
method. |
For information about using an ROI in an app created with App Designer, see Using ROIs in Apps Created with App Designer.
AssistedFreehand
| Circle
| Crosshair
| Cuboid
| drawrectangle
| Ellipse
| Freehand
| Line
| Point
| Polygon
| Polyline