How to display rectangle ROI that was loaded from a file?
조회 수: 7 (최근 30일)
이전 댓글 표시
To be able to save and share figures for my app, I save user-drawn rectangles in a rectangle array and write that to a .mat file. Another user at a later time can import that rectangle array to display on a figure. I have the rectangle array imported properly to matlab, but how can I draw the rectangles from the rectangle array objects rather than the drawrectangle() function? Essentially, I want "drawrectanglefromfile" or "displayrect"
Thanks!
댓글 수: 0
채택된 답변
Voss
2024년 3월 1일
You can set the saved rectangles' parent to be a different/new axes.
Example:
% plot some rectangles:
xlim([0 1])
ylim([0 1])
R = [ ...
rectangle('EdgeColor',[0 0.6 0 ],'Position',[0.2 0.1 0.7 0.6]) ...
rectangle('EdgeColor',[0 0.2 0.8],'Position',[0.1 0.2 0.6 0.7]) ...
];
% save the rectangles to a mat file:
save('R.mat','R')
% load the mat file:
S = load('R.mat')
% put the loaded rectangles in a new axes in a new figure:
figure
ax = gca();
set(S.R,'Parent',ax);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!