error using createMask on imellipse object

3 次查看(过去 30 天)
Hi,
I created a circle (using imellipse) over a plot (imagesc, uint16 matrix).
the code is:
Circ81 = imellipseimellipse(handles.sub1,[(handles.sub1.XLim(2)/2)-r1 handles.sub1.YLim(2)/2-r1 2*r1 2*r1]);
setFixedAspectRatioMode(Circ81,1)
setColor(Circ81,[1 0 0])
Posi = getPosition(Circ81);
ddW81 = createMask(Circ81);
I use this kind of code several times, no problems. For a particular imagesc plot I am getting the following erro:
Error using poly2mask
Expected input number 1, X, to be one of these types: double
Instead its type was single.
Error in poly2mask (line 38)
validateattributes(x,{'double'},{},mfilename,'X',1);
Error in imroi/createMask (line 261)
BW = poly2mask(roix,roiy,m,n);
Error in ACR_test_bmdc>Roi81f (line 6575)
ddW81 = createMask(Circ81);
Error while evaluating UIControl Callback.
I noticed that the BW = poly2mask(roix,roiy,m,n); roix and roiy inside the imroi.m function are indeed single precision, as the error says and a simple double(roix) solves the problem. However, I am not happy to modify an original Matlab function (a read only one) without understanding of what is happening.
Thank you!

回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by