【问题标题】:Get x and y coordinates into variables in macro ImageJ将 x 和 y 坐标转换为宏 ImageJ 中的变量
【发布时间】:2011-02-19 10:40:25
【问题描述】:

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

我已经尝试过 getSelectionCoordinates 但这不起作用。我不想在日志或结果窗口中显示坐标。

任何帮助将不胜感激。

【问题讨论】:

    标签: java image-processing imagej


    【解决方案1】:

    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 不会按照惯例返回值 - 您必须为其指定要设置的变量的名称。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-02
      • 2015-12-31
      • 2022-01-20
      • 1970-01-01
      • 1970-01-01
      • 2011-01-13
      相关资源
      最近更新 更多