How do I modify a "drawassisted" ROI with a "wait" function ?

3 views (last 30 days)
I want to implement freehand and assisted manual segmentation in a GUIDE GUI using MATLAB version 2018b or 2020a.
In the attached test script pft_TestFreehandAssistedSegmentation I can achieve this, with one proviso:
the ROI is committed as soon as it is closed, so there is no opprtunity to add or delete way-points, or to move them around.
I have the same problem with drawpolygon and drawfreehand. However, this must be possible, because I can create a closed ROI,
then modify it, in the Image Segmenter interactive tool. However, this is not a realistic option for the task that I have in mind.
The problem seems to be that the new graphics handle objects don't have a wait method. I can use the old and deprecated impoly as follows:
f = figure('Name', 'Test Impoly Segmentation', 'MenuBar', 'none', 'NumberTitle', 'off');
a = axes(f);
imshow(Section, []);
h = impoly(a);
h.Deletable = false;
setVerticesDraggable(h, true);
wait(h);
BW = createMask(h);
XY = getPosition(h);
delete(h);
save('Impoly-Position.mat', 'XY');
imwrite(BW, 'Impoly-Mask.png');
Is there a way to achieve the same effect with the new functions ? This is to accommodate the way my users work: rough outline first, then refine, then finally commit.

Answers (1)

Pawel Tokarczuk
Pawel Tokarczuk on 16 Jun 2020
To answer my own question:
The wait method which was missing in 2018b is present in 2020a, so I can get the behaviour I want.
This looks like a quiet fix by Mathworks - so, well done ! - but it may be helpful to other users.
Case closed.

Community Treasure Hunt

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

Start Hunting!