Login  Register

Re: ImageJ does not add new plugins to the menu

Posted by Wayne Rasband-2 on Mar 29, 2017; 3:39pm
URL: http://imagej.273.s1.nabble.com/ImageJ-does-not-add-new-plugins-to-the-menu-tp5018403p5018410.html

> On Mar 28, 2017, at 9:56 AM, Paul Cholerzynski <[hidden email]> wrote:
>
> I used it and it worked fine, but as a separate project using ImageJ. I was
> hoping that I could add it directly to the plugins menu (in the plugins
> forder). Another way around is to load my images and open them in
> ImageWindow, but I doun't know yet how to do that.

This example is more complicated than it needs to be. Save the following simplified version in the plugins folder, or sub-folder, as “Cephalometric_Analysis.java", compile it using Plugins>Compile and Run, and it will be added to the Plugins menu, or sub-menu, when you use the Help>Refresh Menus command or restart ImageJ.

-wayne

import ij.*;
import ij.plugin.PlugIn;

public class Cephalometric_Analysis implements PlugIn {

   public void run(String args){
       ImagePlus imp = IJ.open(imageFilePath);
       imp.show;
    }

}



>  Right now it looks like this:
>
> import ij.IJ;
> import ij.ImagePlus;
> import ij.io.Opener;
> import ij.plugin.PlugIn;
> import ij.process.ImageProcessor;
> import ij.gui.ImageWindow;
>
> public class Cephalometric_analysis implements PlugIn{
>    @Override
>    public void run(String args){
>       IJ.showMessage("This is a test");
>        Opener opener = new Opener();  
>        String imageFilePath =
> "C:/Users/Admin/Documents/Notatki/Meh/Obrazy/";
>        ImagePlus imp = opener.openImage(imageFilePath);
>        ImageProcessor ip = imp.getProcessor();
>        ImageWindow(ImagePlus imp);
>        ImageWindow iw = new ImageWindow(imp);
>        iw.setImage(imp);
>    }
>    public static void main(final String... args){
>
>        new ij.ImageJ();        
>        new Cephalometric_analysis().run("");
>    }
> }
>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/ImageJ-does-not-add-new-plugins-to-the-menu-tp5018403p5018406.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html