Help needed with automating image calculation of binary images

fiji
imagej
macro

#1

I am analyzing fluorescence around bugs in cells. For this-I threshold the green channel (bugs) to select bugs (Thres-1). Then I dilate and save it as dia-1, and then this saved image is eroded and saved too as ero-1. Then I use “XOR” feature of morphological operations to make rings/outlines around bugs (green fluorescence) which are labeled as different ROIs and overlayed onto far red fluorescent image of cellular markers (vio-1). The mean fluorescence intensity of the labeled ROIs is then measured and saved as results-1. How to automate this …please help. Below is the recorded macro for one file:

open(“C:/input/Thresh-1.tif”);
run(“Dilate”);
saveAs(“Tiff”, “C:/output/dia-1.tif”;);
run(“Erode”);
saveAs(“Tiff”, “C:/output/ero-1.tif”);
open(“C:/output/dia-1.tif”);
imageCalculator(“XOR create”, “dia-1.tif”,“ero-1.tif”);
selectWindow(“Result of dia-1.tif”);
run(“ROI Manager…”);
roiManager(“Show All with labels”);
run(“Analyze Particles…”, “show=Outlines clear add”);
selectWindow(“Result of dia-1.tif”);
selectWindow(“Drawing of Result of dia-1.tif”);
open(“C:/violet/vio-1.tif”);
selectWindow(“Drawing of Result of dia-1.tif”);
selectWindow(“vio-1.tif”);
run(“From ROI Manager”);
roiManager(“Measure”);
selectWindow(“Drawing of Result of dia-1.tif”);
saveAs(“Results”, “C:/output/Results-1.csv”);

Can anyone please help to automate this for many files?

Thanks,
Alka.