开发者

Get x and y coordinates into variables in macro ImageJ

I want to be able to place a point in an image using the point selection tool, then read the x and y coordinates to variable in a macro.

I've tried getSelectionCoordinates but that isn't working. I don't want to display the coordinates in a log or results win开发者_运维百科dow.

Any help would be much appreciated.


getSelectionCoordinates works fine for me, e.g.:

s = selectionType();

if( s == -1 ) {
    exit("There was no selection.");
} else if( s != 10 ) {
    exit("The selection wasn't a point selection.");
} else {
    getSelectionCoordinates(xPoints,yPoints);
    x = xPoints[0];
    y = yPoints[0];
    showMessage("Got coordinates ("+x+","+y+")");
}

(A common misunderstanding is that getSelectionCoordinates doesn't return a value conventionally - you have to give it the names of variables that it'll set.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜