Access XY co-ordinates on a spline fitted curve

I created a spline fitted curve using segmented line. Then, I got a table containing all the XY-coordiantes on the curve using"Edit->Selections->Properties" (check “List coordinates”). The table looks like this

My question is: how can I access each pair of XY-coordinates in the table using macro? In other words, if I want to print the number in first row and first column (292.000 in this case) using macro, how can I do that?

I have tries something like this:

macro "Draw Curve"{
    setTool("polyline");
    getSelectionCoordinates(xpoints,ypoints);
    Roi.setPolylineSplineAnchors(xpoints,ypoints);
    run("Properties... ", "list");
    print(getResult("X", 1));
}

But it didn’t work. I guess the getResult() only works for the measure table.
Thanks in advance for any help.

This works for me as expected, also with the table displayed by Edit > Selection > Properties, but only if there is no default “Results” table open. If you close the Results table before running your macro code, it should work.

Note that the parameter 1 in your code will retrieve the second result row in your table, as results tables a 0-indexed.


Using one of the supported scripting languages, e.g. Groovy, you can directly get the interpolated polygon coordinates from the PolygonRoi:

// @ImagePlus imp

roi = imp.getRoi()
polygon = roi.getInterpolatedPolygon(1.0, true)

println(polygon.xpoints[0])