display filename in results table in the macro "Measure Cumulative distance
Posted by L on Nov 29, 2013; 6:39am
URL: http://imagej.273.s1.nabble.com/display-filename-in-results-table-in-the-macro-Measure-Cumulative-distance-tp5005739.html
Hi i'd like to have the filename show up in the results table when running the following macro, is this possible?
"Measure Cumulative Distances [1]" {
if (!(selectionType==6||selectionType==10))
exit("Segmented line or point selection required");
getSelectionCoordinates(x, y);
if (x.length<2)
exit("At least two points required");
getPixelSize(unit, pw, ph);
n = nResults;
distance = 0;
for (i=1; i<x.length; i++) {
dx = (x[i] - x[i-1])*pw;
dy = (y[i] - y[i-1])*ph;
distance += sqrt(dx*dx + dy*dy);
setResult("D"+i, n, distance);
}
updateResults;
}
I thought something along the lines of setResult("Label", n, title); where title = getTitle()
might work to add the filename into the Label column but i just am not familiar enough with the coding to work out the right combo.
thanks to any who can help
Cheers