//-- Set up examplerun("Close All");roiManager("reset");run("Blobs (25K)");makePoint(73,42,"small yellow hybrid");roiManager("Add");makePoint(138,52,"small yellow hybrid");roiManager("Add");makePoint(100,74,"small yellow hybrid");roiManager("Add");makePoint(183,102,"small yellow hybrid");roiManager("Add");//-- get the numbernROI=roiManager("count");for(i=0;i<nROI;i++){roiManager("select",i);//-- Your code goes here as if you've selected the ROIrun("Measure");Roi.getCoordinates(xpoints,ypoints);x0=xpoints[0];setResult("Xi",nResults-1,x0);y0=ypoints[0];setResult("Yi",nResults-1,y0);x1=xpoints[xpoints.length-1];setResult("Xf",nResults-1,x1);y1=ypoints[ypoints.length-1];setResult("Yf",nResults-1,y1);d=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));setResult("Displacement",nResults-1,d);updateResults;}
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.