【发布时间】:2014-02-21 08:17:43
【问题描述】:
我正在一个名为 ImageJ 的免费软件中分析 gafchromic 滤镜,该软件使用 Java 的简化形式来编写宏。
我有一组数据点,我已经成功地用不同的方法连接起来,并确定三次多项式最适合数据,但是我需要使用实际曲线,所以我需要以某种方式提取方程/公式多项式。这应该是可能的,因为定义多项式的变量列在生成的图表上,但是我似乎找不到在代码中提取它们的方法。
到目前为止,这是我的代码:
n = nResults();
x = newArray(n);
for (i=0; i<x.length; i++)
{
x[i] = getResult("Grays ", i);
}
y = newArray(n);
for (i=0; i<y.length; i++)
{
y[i] = getResult("Mean ", i);
}
// Do all possible fits, plot them and add the plots to a stack
setBatchMode(true);
for (i = 0; i < Fit.nEquations; i++) {
Fit.doFit(i, x, y);
Fit.plot();
if (i == 0)
stack = getImageID;
else {
run("Copy");
close();
selectImage(stack);
run("Add Slice");
run("Paste");
}
Fit.getEquation(i, name, formula);
print(""); print(name+ " ["+formula+"]");
print(" R^2="+d2s(Fit.rSquared,3));
for (j=0; j<Fit.nParams; j++)
print(" p["+j+"]="+d2s(Fit.p(j),6));
}
setBatchMode(false);
run("Select None");
rename("Curve Fits");
}
【问题讨论】:
-
请注意,@user3336238 在 ImageJ 邮件列表中也有 posted this same question,它是 already answered there。
标签: macros extract equation curve-fitting imagej