gpt4 book ai didi

java - 将 x 和 y 坐标获取到宏 ImageJ 中的变量中

转载 作者:行者123 更新时间:2023-11-29 03:58:20 24 4
gpt4 key购买 nike

我希望能够使用点选择工具在图像中放置一个点,然后将 x 和 y 坐标读取到宏中的变量中。

我尝试了 getSelectionCoordinates,但它不起作用。我不想在日志或结果窗口中显示坐标。

任何帮助将不胜感激。

最佳答案

getSelectionCoordinates 对我来说很好,例如:

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+")");
}

(一个常见的误解是 getSelectionCoordinates 不会按常规返回值 - 您必须为其提供要设置的变量的名称。)

关于java - 将 x 和 y 坐标获取到宏 ImageJ 中的变量中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5050285/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com