How can i edit the points of a saved ROI?

조회 수: 4 (최근 30일)
Leontios Hadjileontiadis
Leontios Hadjileontiadis 2014년 3월 21일
답변: William Thielicke 2023년 11월 30일
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
William Thielicke
William Thielicke 2023년 11월 30일
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!!

댓글을 달려면 로그인하십시오.

답변 (1개)

William Thielicke
William Thielicke 2023년 11월 30일
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!

Translated by