Hello, I don’t quite understand how ImageJ decides how many decimal places will be used for calculation, exporting results, etc.
The following macro illustrates why I am am a bit confused:
run("Blobs (25K)");
setAutoThreshold("Default");
run("Set Measurements...", "area mean perimeter shape redirect=None decimal=2");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 display clear add");
function doCalculation(columnName) {
numbers = newArray(nResults);
for (j=0; j<nResults; j++) {
numbers[j] = getResult(columnName, j);
}
// do calculation here:
Array.getStatistics(numbers, min, max, mean, std);
result = min + max * mean
return result;
}
result = doCalculation("Circ.");
print("Result: " + result);
print("Result: " + doCalculation("Circ."));
close("*");
Using ImageJ 1.52p, I get the following result:
Result: 1.2392
Result: 1.239242024509032
When going the way to first put the result, calculated by the function, into a variable, ImageJ uses 4 decimal places, while it’s 15 when I use the “output” of the function directly. In either case the setting to 2 decimal places set by “Set measurments…” is ignored.
I couldn’t find any information on how ImageJ handles decimal places, so I would be happy if someone could explain or link me to some guide or manual that I’ve overseen. Thanks already!