My partner and I edited a code for a project we are working on:
run("Measure") Roi.getCoordinates(xpoints, ypoints); x0=xpoints; setResult("Xi",nResults-1, x0) y0=ypoints; 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
This works great for what we are trying to do, however it is not very efficient. Is there any way to update this, so we can examine multiple ROIs at once? For example, if we were to use the ‘Measure’ tool on multiple points, they would all show up at once. Can we change this code to do the same"?
Currently, I have to individually click on each ROI from the ROI Manager and run this code, but if we eventually use an image with 500 ROIs, then this is not going to work well.
We are unsure of what the best way to do this would be-- whether we need to add some sort of for loop, or change the code entirely. We are unsure if this is even possible.
Please let me know if you have any advice on this situation. Thank you very much.