Concatenating content of two ROI Managers in Java

imagej

#1

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.


#2

Dear @kbimagej,

this should do the trick:

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

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

Best,
Stefan


#3

what did the recorder record for you?


#4

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