On May 19, 2011, at 3:44 PM, Aaron Johnson wrote:
> In a macro running in batch mode how can I draw the ROIs created with Analyze Particles on a first image (A) onto a second image (B)? The following macro works when not in batch mode but the ROIs do not appear in the second image when running in batch mode. Thanks.
> Aaron
>
> selectImage(A);
> run("Set Measurements...", "area area_fraction display redirect=["+ B +"] decimal=3");
> run("Analyze Particles...", "size=3-Infinity circularity=0.00-1.00 show=Nothing exclude include add");
>
> selectImage(B);
> roiManager("Show All");
> run("Flatten");
> save(dir+B+".jpg");
The ROI Manager "Show All" feature does not work in batch mode. Instead, have the particle analyzer create an "Overlay Outlines" overlay and use the Overlay.copy and Overlay.paste macro functions to transfer the overlay from the first image to the second. Here is an example:
requires("1.45e");
setBatchMode(true);
run("Blobs (25K)");
setAutoThreshold("Default");
run("Analyze Particles...", "size=3 show=[Overlay Outlines] exclude include");
Overlay.copy;
newImage("Untitled", "8-bit Black", 256, 254, 1);
Overlay.paste;
save(getDirectory("home")+"test.jpg");
-wayne