Select 3D ROI from three orthogonal projections of a 3D model in App Designer.
Show older comments
In App Designer, I have 3 axes showing 3 orthogonal projections of a 3D model, where each projection has a 2D ROI and all the 2D ROIs are correlated. It mean, when I draw ROI on one axes, such as app.roi{1} = drawpolygon(app.Projection1);, the ROIs on the other two axes would be automatically created. And when I change the ROI the one axes, the other two would be automatically updated. You can refer to my GUI design attached below.
I have the model to correctly handle the ROI mutual coordinate calculation. I use the following code to draw ROIs, monitor the ROI changes, and update the other two ROIs.
% Callbacks that handle component events
methods (Access = private)
...
% Button pushed function: DrawROIButton
function DrawROIButtonPushed(app, event)
% function to draw ROI on one projection and automatically create
% the other two corresponding ROIs.
% draw ROIs and get positions
switch app.projection
case 1
...
case 2
...
case 3
...
end
% update ROIs when a ROI changes
addlistener(app.roi{1}, 'MovingROI', @(src, evt) app.reDraw23);
addlistener(app.roi{2}, 'MovingROI', @(src, evt) app.reDraw13);
addlistener(app.roi{3}, 'MovingROI', @(src, evt) app.reDraw12);
end
The ROIs drawing part (the switch statement part) works smoothly. However, it seems the ROI updating code only allow me to update the other two ROIs ONLY when I make changes to the projection where I drew ROI on. For example, I draw an ROI on projection 1 and the ROIs on the other two could be created correctly. If I modify the ROI on the projection 1, the other two ROIs could be updated with no problem. BUT, if I modify the ROI on the projection 2, the ones on the other two projections would not be updated. This happens no matter whatever projection I choose to draw ROI on.
I suspected that the callback functions, addlistener(app.roi{2}, 'MovingROI', @(src, evt) app.reDraw13) and addlistener(app.roi{3}, 'MovingROI', @(src, evt) app.reDraw12), are not working when I draw and modify ROI on the projection 1. But I don't know how to fix the issues. Any thoughts or comments will be appreciated.

1 Comment
Varun
on 28 Aug 2023
Hello! Can you please attach your mlapp file to this question? That will help me and others look into the issue better!
Accepted Answer
More Answers (0)
Categories
Find more on ROI-Based Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!