How to hide the ImageJ Thresholding window

imagej
java
thresholding
#1

Hello all,

I am using an ImageJ library in my program and during the thresholding part of my image manipulations the ImageJ thresholding window pops-up. I am using the ImageJ library in my own GUI, so I would like to hide the threshold window that opens when I run my code.

Here is the part that deals with thresholding:

//threshold
IJ.run("Threshold...");  
IJ.setAutoThreshold(imp, "Default");
//Change thresh
imp.getProcessor().setThreshold(imp.getProcessor().getMinThreshold(), imp.getProcessor().getMaxThreshold()*0.65, 1);
Prefs.blackBackground = false;
IJ.run(imp, "Convert to Mask", "");
IJ.run("Close");
println("Thresholding complete...");

Is there any way to stop the window from opening or turn the window visibility off?

Thank you,

Grayson

0 Likes

#2

Better than hiding it, don’t even show it in the first place.

I suggest you delete the following line from your code:

1 Like

#3

That did the trick. Thank you!

0 Likes