Clear Filters
Clear Filters

How can i edit the points of a saved ROI?

4 views (last 30 days)
Hello, when i use the roipoly i have all the interactive facilities in the selection of the ROI points and i can edit the curve until i select CreateMask. Then I save the points of the ROI but i cannot have the same functionality if i just redraw the points in a new figure. I wonder if i could re-activate again the interactive facilities of roipoly but on the drawn ROI in a new figure, so i could make some corrections if needed. Thanks!
  1 Comment
William Thielicke
William Thielicke on 30 Nov 2023
I have the same question. A least I think so.
I display an image, then create a ROI using
figure
imshow(imread('baby.jpg'))
roi = images.roi.AssistedFreehand(Color="y");
draw(roi)
Then, I am drawing a little bit, and when I am lucky with the result, I close the figure. Now I would like to open the same (or maybe even another) image, display the ROI from above, and maybe edit it a bit.
But I do not know how to display an existing ROI (namely the variable "roi" from the iamge above in the newly opened image.
I think converting the ROI to a mask or something and then converting it back to a ROI is not a nice solution.
Thanks for your input!!

Sign in to comment.

Answers (1)

William Thielicke
William Thielicke on 30 Nov 2023
I think I found the solution:
figure
imshow(imread('baby.jpg'))
roi = images.roi.AssistedFreehand(Color="y");
draw(roi)
Then, before closing the figure:
Old_position=roi.Position;
Old_waypoints=roi.Waypoints;
Then the figure can be closed. Open a new figure and display an image
close all
clear roi
figure
imshow(imread('baby.jpg'))
And then let Matlab redraw the ROI from step 1
drawfreehand('Position', Old_position,'Waypoints',Old_waypoints);

Community Treasure Hunt

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

Start Hunting!