Re: generate ROIs around X,Y co-ordinate list
Posted by
Wayne Rasband on
Mar 25, 2009; 9:02pm
URL: http://imagej.273.s1.nabble.com/Re-generate-ROIs-around-X-Y-co-ordinate-list-tp3693172p3693173.html
> Hi All,
>
> I am trying to automate segmentation of small fluorescence events. In
> the process, I was planing on using the Analyze particles to help with
> this job. So far so good. But I am wondering how I might go about
> using the centroid X.Y position from the particle analysis to then go
> back and create ROIs of a predetermined size around the list of
> centroid co-ordinates. In theory this shouldn't be hard, but I'm at a
> loss for how to code it (i.e. gather the XY list from the results
> table and hand it to the ROI manager or generate regions).
You can do this using a macro that retrieves the X and Y coordinates
from the Results table and uses them to generate ROIs of a
predetermined size. This example runs the particle analyzer on the
blobs sample image and, for each particle found, generates a radius 15
circular ROI and adds it to the ROI Manager.
radius = 15;
run("Blobs (25K)");
setAutoThreshold();
run("Set Measurements...", "area mean centroid redirect=None");
run("Analyze Particles...", "size=0 circularity=0.00 display exclude
clear");
resetThreshold();
roiManager("reset");
for (i=0; i<nResults; i++) {
x = getResult("X", i);
y = getResult("Y", i);
makeOval(x-radius, y-radius, radius*2, radius*2);
run("Add to Manager ");
}
setOption("Show All",true);
-wayne