微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何将DefaultGenericTable更改为结果表

如何解决如何将DefaultGenericTable更改为结果表

更新:ImageJ forum中为我回答了此问题。我错过了 results_table.incrementCounter()

我正在尝试修改悬吊式下垂插件,以便它使用结果表而不是认的通用表。

我更改了以下代码

results = new DefaultGenericTable(colCount,stack.getSize());
        results.setColumnHeader(0,"slice");
        results.setColumnHeader(1,"tip radius");
        results.setColumnHeader(2,"tip x");
        results.setColumnHeader(3,"tip y");
        results.setColumnHeader(4,"gravity angle");
        results.setColumnHeader(5,"capillary length");
        results.setColumnHeader(6,"surface tension");
        results.setColumnHeader(7,"volume");
        results.setColumnHeader(8,"surface");
        results.setColumnHeader(9,"RMS fit distance (pixels)");

            results.set(0,n,n+1);
            results.set(1,drop.getTipRadius());
            results.set(2,drop.getTipX());
            results.set(3,drop.getTipY());
            results.set(4,drop.getGravityAngle());
            final double capLength = drop.getCapillaryLength();
            results.set(5,capLength);
            final double surface_tension = capLength * capLength * rho_g;
            results.set(6,surface_tension);
            results.set(7,dropFit.getVolume());
            results.set(8,dropFit.getSurface());
            results.set(9,Math.sqrt(dropFit.getFitdistance()));

            import ij.measure.ResultsTable;
            results_table.addValue("slice",n);
            
            results_table.addValue("tip radius",drop.getTipRadius());
            results_table.addValue("tip x",drop.getTipX());
            results_table.addValue("tip y",drop.getTipY());
            results_table.addValue("gravity angle",drop.getGravityAngle());
            final double capLength = drop.getCapillaryLength();
            results_table.addValue("capillary length",capLength);
            final double surface_tension = capLength * capLength * rho_g;
            results_table.addValue("surface tension",surface_tension);
            results_table.addValue("volume",dropFit.getVolume());
            results_table.addValue("surface",dropFit.getSurface());
            results_table.addValue("RMS fit distance (pixels)",Math.sqrt(dropFit.getFitdistance()));
            
        results_table.show("Results");

但是,在ImageJ中运行插件时出现此错误

[ERROR] Module threw exception
java.lang.IllegalArgumentException: Counter==0
    at ij.measure.ResultsTable.addValue(ResultsTable.java:178)

我做错了或应该怎么做?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。