如何将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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...