Search code examples
imagejimagej-macro

getResult() returns NaN for everything but "Area"


I'm trying to get the centroid's X and Y values from the Results table, but I can't use getResult() with anything but "Area". All other columns (which are regularly displayed on the table) return NaN.

I'm not using any special plugin, the table is created using "Analyze Particles..."

Any idea what could be causing this?

getResult("Area", 0) works.

getResult("X", 0) does not work. (Returns NaN)


Solution

  • I guess I figured it out. There was a run("Clear Results...") line before this loop, and even though it worked well to remove some partial results (scaling), it also bugged the Results columns names for some reason. I replaced it with IJ.deleteRows(0, 1), because there were two measurements regarding the two points used as scale references.