MATLAB Answers

'drawcircle' and 'roi.cricle' do not respect preset Radius

6 views (last 30 days)
Tamara del Águila
Tamara del Águila on 8 Apr 2021
Answered: Matt J on 8 Apr 2021
I am trying to make a circular roi with a specified R,but allowing to set the center and the position. I first thought of doing it with 'ginput' and later drawing the circle, but since I need to allow for interactive reposition, I switched to 'roi' creation (image.roi.circle).
However, for some reason, something happens with the Radius and it's never set as defined, or it allows interactive setting of the radius... I tried both with 'drawcircle' and 'draw' (predefining the roi), but none works for me as I want to. This is the code for 'drawcircle':
figure
imagesc(background);
drawncircle = drawcircle('InteractionsAllowed', 'translate','Radius',6, 'LineWidth',1.5);
Warning: The ROI was not fully defined. 'Radius' will be ignored and interactive placement will begin.
> In drawcircle (line 187)
And here the code for roi definition + draw():
figure
imagesc(background);
drawnroi = images.roi.Circle('InteractionsAllowed', 'translate','Radius',6, 'LineWidth',1.5);
draw(drawnroi);
In both cases, the first time I run it, it yields the warning, sets the Radius to the minimum, and the field 'Radius' of the roi is set to zero. However, if I run it again once the object has been created, what it does is to interactively allow the radius definition. (while in the permisions I only allow for moving it!).
Does anyone know what am I doing wrong or how can I get what I need? (thanks in advance)

Answers (1)

Matt J
Matt J on 8 Apr 2021
I think you need to specify the center coordinate as well.

Community Treasure Hunt

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

Start Hunting!