I try to write Java Plugin to ImageJ, which should:
- Load image (24-bit).
- Do some preprocessing operations.
- Threshold the image in numerous of methods.
- Do some other operations.
I have problem with threshold operation. Part of my code looks like this:
Opener opener = new Opener();
ImagePlus imp = opener.openImage(source);
// Preprocessing
IJ.run("Threshold..." , method);
// Other operations e.g. "open", "outline" etc.
IJ.saveAs(destination);
My goal is to get binarized image in various methods (e.g. "Default", "Huang", "Intermodes", "IsoData", "Li" etc.). Only way which I can get binarized image is to run:
IJ.run(imp, "8-bit", "");
IJ.run(imp, "Make Binary", "");
however, I get an image binarized by only one method. How to do automatic threshold by running Java code (ImageJ plugin)?