Hey, I tried to write the macro myself.

I had the same problems some time ago but I got some code working, so I’m happy to share:

```
//macro imageJ-forum - hope this helps
path=getDirectory("Choose a Directory");
list = getFileList(path);
for (i=0; i<list.length; i++) {
open(path+list[i]);
title = getTitle();
//you can add every measurement here that you are interested in, just use the macro recorder
run("Set Measurements...", "area feret's redirect=None decimal=3");
run("8-bit");
setTool("line");
waitForUser("Draw a line that is exactly your scalebar");
run("Set Scale...", "known=500 pixel=1 unit=um global");
run("Invert");
run("Threshold...");
setThreshold(235, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
//***********I added this because I found it suitable, but there is no need to use it, you didn't want it in the first place***********
run("Fill Holes");
run("Analyze Particles...", "size=10000-Infinity pixel summarize add");
if (isOpen("ROI Manager")) {
selectWindow("ROI Manager");
roicount = roiManager("Count");
for (n=0;n<roicount;n++){
roiManager("Select",n);
roiManager("Measure");
}}
//saves all measurements as an excel file, not needed though
if(isOpen("Results")) { selectWindow("Results");
saveAs("results", path + title + "_all_data.xls");
run("Close");}
if(isOpen(title)){selectWindow(title); close();}
if(isOpen("ROI Manager")) {selectWindow("ROI Manager"); run("Close");}
}
//finish everything and calculation
if(isOpen("Summary")) {selectWindow("Summary");
IJ.renameResults("Results");}
number = nResults;
for (j=0; j<number; j++) {
area = getResult("Average Size");
radius = sqrt(area/3.14159);
diameter = radius * 2;
setResult("MEAN Diameter", j, diameter);
}
```

I dont know if you need all this.

Basically, it asks you for a folder where your pictures are located. It opens the file, analyses it as you asked and saves all measurements as a separate excel file. If you want to have more information, you can modiy the “Set Measurements” command in one of the first lines.

I didnt really know how to calculate the diameter from the area. Are you assuming that they are circular? if yes, everything in the final calculations is fine.

If not, I included the Ferret-Diameter, which is the maximum diameter that a particle has.

You will get a “Results”-table in which you have a lot of data, the last one being “Mean Diameter” as calculated from the mean area per picture assuming that the cells are circular objects.

Keep in mind that there might be better ways to calculate different types of shapes, but that is surely beyond this thread

Also, you need to draw the scalebar every time. I also have a workaround for this, but this would take me some minutes to implement. But if you need it I could provide

Please tell me if there are some problems, I’m happy to help.

Best