Turn off prompt when changing RoiManager's line color in a Jython script

I am trying to write a script in Jython to work with the ROI manager and change the line color of the ROIs drawn on the detected particles. The two key lines are:

rm = RoiManager.getInstance()
rm.runCommand("Set Color", "yellow")

This produces a “ROI Manager” dialog box with the prompt:

Apply changes to all 43 selections?

I need to click “OK”. Is there a way to turn off the prompt? I tried rm.allowRecording(True) and that did not make a difference.

What am I missing?

Thanks,
John

1 Like

Beforehand I would select a ROI in the ROI Manager. Then this dialog should’nt appear, e.g., :

rm.select(1);

I think if no ROI is selected in the ROIManager all ROI’s are returned with the API (at least the last time I used it).

If you would like to change all ROI’s then iterate select and change all ROI’s in the ROIManager, see something like:

1 Like

Thanks, you solved my problem. I ended up using a for loop as described in the post you linked