Q:

Auto threshold in ImageJ/FIJI with Python

I'm trying to write python scripts in ImageJ and I'm having problems with autothresholding. It won't let me use the IJ.setAutoThreshold("Default dark"). An example bit of code is below (with a few things left out for clarity):
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

Setting the auto threshold here gives 
AttributeError: type object 'ij.IJ' has no attribute 'setAutoTrheshold'

How can I access ImageJ's threshold function?
Cheers!

A:

Have a look at the javadoc: IJ has a method taking two arguments
setAutoThreshold(ImagePlus imp, String method)

so in your case
IJ.setAutoThreshold(imp, "Default dark")

should work.

