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.