http://imagej.273.s1.nabble.com/ImageJ-does-not-add-new-plugins-to-the-menu-tp5018403p5018447.html
[1]. I mention this specifically because I noticed from a different thread
that you are using ImageJ 1.x.
> Hi Stein,
>
> > Using Javascript as an alternative to a plug-in is an interesting
> approach;
>
> See this section of the wiki:
http://imagej.net/Scripting>
> > I wonder whether or not it is possible to control what menu the script
> appears in
>
> If you place a (e.g. Groovy) script at scripts/Foo/Bar/My_Script.groovy
> then it will appear in menus at Foo > Bar > My Script.
>
> > Can we have a javascript inside a jar?
>
> Yes, if you place a script at e.g. scripts/Foo/Bar/My_Script.groovy
> inside a JAR file, it will appear in the menus at Foo > Bar > My Script.
>
> Regards,
> Curtis
>
> --
> Curtis Rueden
> LOCI software architect -
https://loci.wisc.edu/software> ImageJ2 lead, Fiji maintainer -
https://imagej.net/User:Rueden> Did you know ImageJ has a forum?
http://forum.imagej.net/>
>
> On Wed, Apr 5, 2017 at 1:06 PM, Stein Rørvik <
[hidden email]>
> wrote:
>
>> Using Javascript as an alternative to a plug-in is an interesting
>> approach;
>> I wonder whether or not it is possible to control what menu the script
>> appears in, in the same way as plugins.config does ? Can we have a
>> javascript inside a jar?
>>
>> Stein
>>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
>> Wayne Rasband
>> Sent: 01. april 2017 23:58
>> To:
[hidden email]
>> Subject: Re: ImageJ does not add new plugins to the menu
>>
>> > On May 29, 2017, Curtis Rueden (
[hidden email]) wrote:
>> >
>> > Hi Wayne & everyone,
>> >
>> > Wayne wrote:
>> >> compile it using Plugins>Compile and Run
>> >
>> > Please note that "Refresh Menus" and "Compile and Run" are not
>> > currently supported in ImageJ2 [1, 2, 3].
>> >
>> >> This example is more complicated than it needs to be.
>>
>> The example can be further simplified, and it can avoid the non-working
>> "Compile and Run” command in Fiji, by converting it into JavaScript. Save
>> the following two line JavaScript version in the plugins folder, or
>> sub-folder, as “Cephalometric_Analysis.js" and it will be added to the
>> Plugins menu, or sub-menu, after you use the Help>Refresh Menus command or
>> restart ImageJ.
>>
>> imp = IJ.openImage(“”);
>> imp.show();
>>
>> JavaScript is now a compiled language so it runs up to 30 times faster
>> than the ImageJ macro language. Use the Sphere examples in the
>> Help>Examples menu to compare the speed of the macro language, JavaScript,
>> Beanshell, Python and Java. You will need to change the ‘size’ variable
>> from 512 (0.25 megapixels) to 4096 (16 megapixels) to get a fair
>> comparison. JavaScript is able to calculate a 16 megapixel image in a 0.3
>> seconds.
>>
>> Note that this example will not work in Fiji as a menu command unless you
>> add a statement that imports the IJ.class. It will work as is in the Script
>> Editor if you enable the Edit>Auto-import (deprecated) option.
>>
>> -wayne
>>
>> > I agree that the example is too complicated. However, I think there is
>> > a middle ground here -- we want to provide a hackable template from
>> > which real-world plugins can be easily created. E.g.: it should show
>> > how to use GenericDialog, which most plugins will need.
>> >
>> > As always, pull requests improving the example are most welcome.
>> >
>> > Paul wrote:
>> >> I was hoping that I could add it directly to the plugins menu (in the
>> >> plugins forder).
>> >
>> > Certainly you should be able to do that, by building the JAR file and
>> > dropping it into your ImageJ plugins folder. The plugins.config file
>> > in src/main/resources defines which plugins appear where in the menus.
>> >
>> > The example-legacy-plugin uses a hack in the main method [4] to set
>> > the plugins directory to match the IDE's runtime classpath. By doing
>> > this, the plugin will appear in the Plugins menu without needing to
>> refresh the menus.
>> >
>> > Regards,
>> > Curtis
>> >
>> > [1]
https://github.com/imagej/imagej-legacy/issues/98>> > [2]
https://github.com/imagej/ij1-patcher/issues/31>> > [3]
https://github.com/imagej/imagej-ui-swing/issues/48>> > [4]
>> >
https://github.com/imagej/example-legacy-plugin/blob/59bba7bf39f77e63c>> > 4e4498cb0643200b4c5b673/src/main/java/com/mycompany/imagej/Process_Pix
>> > els.java#L172-L176
>> >
>> > --
>> > Curtis Rueden
>> > LOCI software architect -
https://loci.wisc.edu/software>> > ImageJ2 lead, Fiji maintainer -
https://imagej.net/User:Rueden Did you
>> > know ImageJ has a forum?
http://forum.imagej.net/>> >
>> >
>> > On Wed, Mar 29, 2017 at 10:39 AM, Wayne Rasband <[hidden email]> wrote:
>> >
>> >>> 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.htm
>> >> l
>> >>> 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>> >>
>> > « [hide part of quote]
>> >
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>
>