Posted by
Arreis on
Oct 12, 2015; 7:34pm
URL: http://imagej.273.s1.nabble.com/ImageJ-How-to-measure-multiple-ROI-in-Batch-Process-using-Macro-and-save-each-ROI-s-result-in-indivie-tp5014612.html
I have 1000 images in a folder. Each images have four ROIs labelled A, B ,C and D and I wanted to measure it's grey value (min, max and mean). Is it possible to run a Macro from Batch Process that can measure each ROI and return four individual ROI results like a set of measurements for A in one table then a set of measurements for B in another table and so on.
I tried the following Macro to analyze ROI labelled A then automatically save it to A.xls.
run("8-bit");
run("Set Measurements...", "area mean standard min bounding area_fraction stack display redirect=None decimal=3");
makeRectangle(0, 0, 356, 301);
run("Measure");
dir = getDirectory("image");
index = lastIndexOf(dir, ".");
name = "A" + ".xls";
saveAs("Measurements", dir+name);
Naively

, I copied the same Macro and changed the makeRectangle value for ROI B then paste it on the next line hoping that it measures the ROI and save it to B.xls. Now it looks like this:
run("8-bit");
run("Set Measurements...", "area mean standard min bounding area_fraction stack display redirect=None decimal=3");
makeRectangle(0, 0, 356, 301);
run("Measure");
dir = getDirectory("image");
index = lastIndexOf(dir, ".");
name = "A" + ".xls";
saveAs("Measurements", dir+name);
run("8-bit");
run("Set Measurements...", "area mean standard min bounding area_fraction stack display redirect=None decimal=3");
makeRectangle(410, 0, 310, 246);
run("Measure");
dir = getDirectory("image");
index = lastIndexOf(dir, ".");
name = "B" + ".xls";
saveAs("Measurements", dir+name);
close();
It does save the B.xls but it contains ROI A measurements as well which means the result is a combination of region A and B. I need A.xls to have ROI A measurements only and B.xls to contain ROI B only. Any help is appreciated. Thank you darlings.
- Love, Arreis