The RoiManager#runCommand()
method is not static, that means you have to call it on an instance of the RoiManager
class. To get this instance, call:
rm = RoiManager.getInstance();
if (rm==None):
rm = RoiManager();
The following code opens a sample image, creates two ROIs, and saves them in the user's home directory:
from ij.plugin.frame import RoiManager;
rm = RoiManager.getInstance();
if (rm==None):
rm = RoiManager();
imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
imp.setRoi(100, 80, 50, 80);
rm.addRoi(imp.getRoi());
imp.setRoi(180, 140, 30, 40);
rm.addRoi(imp.getRoi());
rm.runCommand("Deselect"); # deselect ROIs to save them all
rm.runCommand("Save", IJ.getDirectory("home") + "RoiSet.zip");
imp.show();
Hope that helps.