There is a way.
Use IJ.run("plugin name", "plugin options");
I don't know what you mean by keeping all your code in your plugin though. Your plugin is dependent on imageJ code, so you won't be in total control of your plugin no matter what.
Another option you have is to copy the threshold files into your plugin package. In fact, this is what I did. If you choose to do this, there are two ways that I can think of in which you can interact with the copied files:
1) Put an underscore in the copied file's name and then you should be able to run it through the IJ.run("copied_plugin_namespace", "plugin options");
2) Study the copied files and find a point of entry that would produce the same results as IJ.run() and/or modify the copied files to have a good point of entry if one does not already exist.
ColinWhite wrote
Hi all,
I'm wondering if there is a way to threshold an image in a plugin? I know I can do it in a macro, but I'd prefer to keep all my code in my plugin file.
Thanks,
Colin