2014-12-23 128 views
2

我正试图在ImageJ中编写python脚本,并且遇到了自动阈值问题。它不会让我使用IJ.setAutoThreshold("Default dark")。代码示例位下方(为了清楚起见,省略了一些东西):Python中的ImageJ/FIJI中的自动阈值

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的门槛功能?

干杯!

回答

2

看一看的javadocIJ有服用两个参数

setAutoThreshold(ImagePlus imp, String method) 

的方法使你的情况

IJ.setAutoThreshold(imp, "Default dark") 

应该工作。