// This macro tests the speed of the ROI Manager // running in batch mode and not in batch mode. // Make sure the ROI Manager is closed if the macro, like // this one, runs entirely in batch mode. ImageJ will use // an invisible ROI Manager that will run faster and more // reliably. Replace this code with roiManager("reset") in // macros that do not run entirely in batch mode. if (isOpen("ROI Manager")) { selectWindow("ROI Manager"); run("Close"); } t1 = test(true); t2 = test(false); showMessage("Speed Test", "This macro runs "+round(t2/t1)+" times faster in batch mode"); exit; function test(batchMode) { width = 1000; height = 1000; n = 250; areas = newArray(n); means = newArray(n); setBatchMode(batchMode); roiManager("reset"); newImage("Untitled", "8-bit ramp", width, height, 1); start = getTime; for (i=0; i