MATLAB: How to Move Multiple ROI’s at the same time

roi

Hi Everyone 🙂
I have 4 ROI's on an image, and I want to move the left two, and then the right two collectively in the figure (So grouping two ROIs to move simultaneously). Is there a way to do this?
Thank You!!

Best Answer

What you want is not really supported by impoly. You could sort of fake it by merging the two polygon positions separated with row of nans and ending with another row of nan to prevent the closing of the final polygon.
mergedcoordinates = [[LPP1; LPP2; LPP3; LPP4; %original poly
LPP1; %to close the first polygon
nan nan; %to separate the 2nd polygon
RPP1; RPP2; RPP3; RPP4; %2nd polygon
RPP1; %to close the 2nd polygon
nan nan] %to prevent closing back to LPP1
mergedpoly = impoly(gca, mergedcoordinates);
This works in that you can drag both polygon together but breaks a lot of other things (such as impoly.createMask.