Multi-ROI analysis Macro

Hello all,

i search to repeat this ROI analysis macro on an image 2000x2000. I want to define 100 ROI of 200x200. the variable parameters are the third line “makerectangle (0,0,200,200)”. i want to define variable for the two first value (A and B here) : “makerectangle (A, B, 200 , 200)”. These value are regular value n-1 = n-200 and n+1 = n+200 …

Do you can help me to define this and don’t make 100 copy/past please? :slight_smile: thank’s a lot for advance.

//open image
makeRectangle(0, 0, 200, 200);
// clean up
run("Clear Results");
// read out histogram
getStatistics(area, mean, min, max, std, histogram);
// write histogram to a table
if (bitDepth==8 || bitDepth==24) {
   for (i=0; i<histogram.length; i++) {
       setResult("Value", i, i);
       setResult("Count", i, histogram[i]);
} else {
   value = min;
   binWidth = (max-min)/256;
   for (i=0; i<histogram.length; i++) {
       setResult("Value", i, value);
       setResult("Count", i, histogram[i]);
       value += binWidth;
// save table to disc
saveAs("Results", "S:\\Anto\\test 2D\\CSV\\1.xls");

The documentation you are looking for is here:

If you still have questions after reading that page, ask here and we will help! :smile: