setClosed
Set closure behavior of ROI object
setClosed
is not recommended. With the new ROIs, use the
Closed
property instead. For more information, see Version History.
Syntax
Description
Input Arguments
h
— ROI object
imfreehand
| impoly
ROI object, specified as an imfreehand
or impoly
object.
TF
— ROI object is closed
true
| false
ROI object is closed, specified as true
or
false
. When set to true
, a
straight line connect the endpoints of the ROI object to create a closed
region. If set to false
, the endpoints are not connected
and the region is open.
Data Types: logical
Version History
Introduced in R2007bR2018b: setClosed
is not recommended
Starting in R2018b, a new set of ROI objects replaces the existing set of ROI objects. The new objects provide more functional capabilities, such as face color transparency. The new classes also support events that you can use to respond to changes in your ROI such as moving or being clicked. Although there are no plans to remove the old ROI objects at this time, switch to the new ROIs to take advantage of the additional capabilities and flexibility. For more information on creating ROIs using the new ROI functions, see Create ROI Shapes.
In the existing ROIs, you can control whether a hand-drawn shape or a polygonal
shape are closed or open. By default, when you double-click to draw the final vertex
of one of these shapes, the ROI draws a line between the last vertex and the first
vertex to close the shape. Using the setClosed
method, you can
create an open hand-drawn shape or polyline. With the new ROIs, the
Freehand
and AssistedFreehand
shapes
support a Closed
property that you can use to specify whether the
shape is closed or open. The new ROIs support both a polygon (closed) and a polyline
(open) shape, so there is no need for these ROIs to support a
Closed
property.
Update all instances of setClosed
.
Discouraged Usage | Recommended Replacement |
---|---|
This example creates a polygonal ROI and uses the
imshow('cameraman.tif');
h = impoly(gca,[10 10; 50 10; 20 100]);
setClosed(h,false);
| To create an open polyline ROI, replace the call to the
imshow('cameraman.tif'); h = drawpolyline(gca,'Position',[10 10; 50 10; 20 100]); |
This example creates a hand-drawn ROI and uses the
imshow('cameraman.tif');
h = imfreehand;
setClosed(h,false);
| To create an open, hand-drawn ROI shape, replace the
call to imshow('cameraman.tif');
h = drawfreehand;
h.Closed = false; |
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)