我正在尝试在 ImageJ 中编写 python 脚本,但我遇到了自动阈值处理问题。它不允许我使用 IJ.setAutoThreshold("Default dark")。下面是一段代码示例(为清楚起见,省略了一些内容):
from ij import IJ, ImagePlus
from java.lang import Runtime, Runnable
import os
for i in filepaths: #filepaths being the files I'm opening
IJ.open(i)
IJ.run("Split Channels") #this is splitting a two channel image
imp = IJ.getImage()
imp.close() #this is closing the channel I don't want
IJ.setAutoThreshold("Default dark") #this is trying to set a threshold
在这里设置自动阈值给出
AttributeError: type object 'ij.IJ' has no attribute 'setAutoTrheshold'
如何访问 ImageJ 的阈值函数?
干杯!
请您参考如下方法:
看看 javadoc : IJ 有一个方法接受两个参数
setAutoThreshold(ImagePlus imp, String method)
所以在你的情况下
IJ.setAutoThreshold(imp, "Default dark")
应该可以。
