Loading README.md +5 −0 Original line number Diff line number Diff line Loading @@ -22,5 +22,10 @@ directory, run _Help>Refresh Menus_ and the plugin will be available in _Process>Process Pixels_ (this can be changed by editing _src/main/resources/plugins.config_). Developing plugins in an IDE is convenient, especially for debugging. To that end, the plugin contains a _main()_ method which sets the _plugins.dir_ system property (so that the plugin is added to the Plugins menu), starts ImageJ, loads an image and runs the plugin. Since this project is intended as a starting point for your own developments, it is in the public domain. src/main/java/Process_Pixels.java +27 −0 Original line number Diff line number Diff line import ij.IJ; import ij.ImageJ; import ij.ImagePlus; import ij.gui.GenericDialog; import ij.plugin.filter.PlugInFilter; Loading Loading @@ -154,4 +155,30 @@ public class Process_Pixels implements PlugInFilter { "a template for processing each pixel of an image" ); } /** * Main method for debugging. * * For debugging, it is convenient to have a method that starts ImageJ, loads an * image and calls the plugin, e.g. after setting breakpoints. * * @param args unused */ public static void main(String[] args) { // set the plugins.dir property to make the plugin appear in the Plugins menu Class<?> clazz = Process_Pixels.class; String url = clazz.getResource("/" + clazz.getName().replace('.', '/') + ".class").toString(); String pluginsDir = url.substring(5, url.length() - clazz.getName().length() - 6); System.setProperty("plugins.dir", pluginsDir); // start ImageJ new ImageJ(); // open the Clown sample ImagePlus image = IJ.openImage("http://imagej.net/images/clown.jpg"); image.show(); // run the plugin IJ.runPlugIn(clazz.getName(), ""); } } Loading
README.md +5 −0 Original line number Diff line number Diff line Loading @@ -22,5 +22,10 @@ directory, run _Help>Refresh Menus_ and the plugin will be available in _Process>Process Pixels_ (this can be changed by editing _src/main/resources/plugins.config_). Developing plugins in an IDE is convenient, especially for debugging. To that end, the plugin contains a _main()_ method which sets the _plugins.dir_ system property (so that the plugin is added to the Plugins menu), starts ImageJ, loads an image and runs the plugin. Since this project is intended as a starting point for your own developments, it is in the public domain.
src/main/java/Process_Pixels.java +27 −0 Original line number Diff line number Diff line import ij.IJ; import ij.ImageJ; import ij.ImagePlus; import ij.gui.GenericDialog; import ij.plugin.filter.PlugInFilter; Loading Loading @@ -154,4 +155,30 @@ public class Process_Pixels implements PlugInFilter { "a template for processing each pixel of an image" ); } /** * Main method for debugging. * * For debugging, it is convenient to have a method that starts ImageJ, loads an * image and calls the plugin, e.g. after setting breakpoints. * * @param args unused */ public static void main(String[] args) { // set the plugins.dir property to make the plugin appear in the Plugins menu Class<?> clazz = Process_Pixels.class; String url = clazz.getResource("/" + clazz.getName().replace('.', '/') + ".class").toString(); String pluginsDir = url.substring(5, url.length() - clazz.getName().length() - 6); System.setProperty("plugins.dir", pluginsDir); // start ImageJ new ImageJ(); // open the Clown sample ImagePlus image = IJ.openImage("http://imagej.net/images/clown.jpg"); image.show(); // run the plugin IJ.runPlugIn(clazz.getName(), ""); } }