I've found this post which uses the IJ.runMacro() method, but I'm confused as to what the "Clown (14K)" refers to, and I want to use a macro that I made myself, not one downloaded from imageJ's website.
My macro is just this for now:
run("Non-local Means Denoising", "sigma=5 smoothing_factor=1");
and that works in ImageJ when I use the batch processor. (Non-Local Means Denoising is an ImageJ Plugin)
My two questions are these:
How do I call a macro that I made using the IJ.runMacro method (or alternative)?
How do I specify what image the runMacro method will affect?
Thank you for your time.
I finally found the answer to my question here
The line of code that ended up solving it was:
System.setProperty("plugins.dir", "C:\\Users\\Speedy Octopus\\Downloads\\ij150-win-java8\\ImageJ\\plugins");
So the entire Test class looks like this now:
import ij.IJ;
import ij.ImagePlus;
import ij.io.FileSaver;
import ij.plugin.PlugIn;
public class Test implements PlugIn {
public static void main(String[] args) {
Test test = new Test();
test.run("Denoise.ijm");
}
@Override
public void run(String arg0) {
String directory = "C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10.JPG";
ImagePlus imp = IJ.openImage(directory);
FileSaver fileSaver = new FileSaver(imp);
System.setProperty("plugins.dir", "C:\\Users\\Speedy Octopus\\Downloads\\ij150-win-java8\\ImageJ\\plugins");
IJ.run(imp, "Non-local Means Denoising", "sigma=5 smoothing_factor=1");
fileSaver.saveAsJpeg("C:\\Users\\Speedy Octopus\\Desktop\\10Cover Shots\\10edited.JPG");
}
}