Skip to content

Instantly share code, notes, and snippets.

@miyanari
Forked from miura/32bit autothreshold.py
Created September 3, 2013 17:02
Show Gist options
  • Select an option

  • Save miyanari/6426590 to your computer and use it in GitHub Desktop.

Select an option

Save miyanari/6426590 to your computer and use it in GitHub Desktop.
imp = IJ.getImage()
midslice = int(imp.getStackSize() / 2)
imp.setSlice(midslice)
#IJ.setThreshold(-50, -0.62)
ip.setAutoThreshold(AutoThresholder.Method.Default, False)
IJ.setThreshold(ip.getMinThreshold(), ip.getMaxThreshold())
print ip.getMaxThreshold()
print ip.getMinThreshold()
#th = ip.getMaxThreshold()
IJ.run("Convert to Mask", "method=Default background=Light black")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment