Creating multi-circles from multi-point selection and then find the Maxima

Hi,

I want to create a macro where it

  1. asks me to make multi-point selection, then create a circle around all the point I created.
  2. Then, asks me to confirm the coordinate of all the circle before pressing OK
  3. it calculate the Maxima in each circle and record them in a table

This is what I created:

setTool("multipoint");
    waitForUser("Please select points in the genre of the well. Click OK when done")
    getSelectionCoordinates(xpoints, ypoints);
    radius=500;
    for (i=0; i<lengthOf(xpoints); i++) {
    makeOval(xpoints[i]-radius, ypoints[i]-radius, 2*radius, 2*radius);
    waitForUser("Confirm the cooardinate of the circles. Click OK when done")
    run("Find Maxima...", "noise=10 output=[Segmented Particles]");
    }

However, it only make one circle around the very first point and it fails also to calculate and record the maxima.

I’m not sure how to correct it. Any suggestions? Thank you very much.

Sorry, just want to add that I just made few corrections:

setTool("multipoint");
    waitForUser("Please select center points for all areas of interest. Click OK when done")
    getSelectionCoordinates(xpoints, ypoints);
    radius=500;
    for (i=0; i<lengthOf(xpoints); i++) {
    makeOval(xpoints[i]-radius, ypoints[i]-radius, 2*radius, 2*radius);
    waitForUser("Confirm the cooardinate of the circles. Click OK when done");
    run("Find Maxima...", "noise=10 output=[Segmented Particles]");
    getResult("Maxima");
    updateResults();
    }

However, I got the Maxima for all the image rather than the selection (circle). I’m pretty sure it’s easy but can’t figure out what could have gone wrong?

Many Thanks