Main Content


Preserve aspect ratio when resizing ROI object

setFixedAspectRatioMode is not recommended. With the new ROIs, set the value of the FixedAspectRatio property instead. For more information, see Compatibility Considerations.



setFixedAspectRatioMode(h,TF) sets whether the aspect ratio of the ROI object is preserved during interactive resizing.


collapse all

Create an ellipse ROI object.

h = imellipse(gca,[10 10 100 100]);

Specify a position constraint function using makeConstrainToRectFcn to keep the ellipse inside the boundary of the image.

fcn = makeConstrainToRectFcn("imellipse",get(gca,"XLim"),get(gca,"YLim"));

Try resizing and reshaping the ellipse.

Now, fix the aspect ratio of the ellipse.


Try resizing the ellipse. The aspect ratio of the ellipse does not change.

Input Arguments

collapse all

ROI object, specified as an imellipse or imrect object.

Fix the aspect ratio when resizing ROI object, specified as true or false.

Data Types: logical

Version History

Introduced before R2006a

expand all

See Also