Concatenating content of two ROI Managers in Java



I have two objects of type ROI Manager RM1 and RM2. RM1 is saved as a .zip file and the ROI Manager active is RM2. I want to append all the ROIs of RM1 into RM2. I tried using Recorder, but didn’t get any specific line of code which does the needful.


Dear @kbimagej,

this should do the trick:

RoiManager rm = RoiManager.getInstance();
rm.runCommand("Open", "/path/to/");

When you switch to recording a Macro instead of Java you get roiManager("Open", "/path/to/");. Such roiManager(...) functions translate to rm.runCommand(...) in Java.



what did the recorder record for you?


I didn’t get anything. But Stefan’s method solves the issue.