我正在尝试在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的阈值功能?
干杯!
答案 0 :(得分:2)
看一下javadoc:IJ
有一个带两个参数的方法
setAutoThreshold(ImagePlus imp, String method)
所以在你的情况下
IJ.setAutoThreshold(imp, "Default dark")
应该有用。