Second-level Plug-in Menus

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Second-level Plug-in Menus

Richard VanMetter
Putting plug-ins in a second level menu is a useful feature that seems
to work sometimes and not others. By not working, I mean that ImageJ
simply ignores the second-level folder in \plugins or some of the
plugins contained in that folder.  I have investigated, trying to find
the trick to making it work, but without success. Perhaps someone can
clarify it for me.

Here's and example. Take the plugins that come shipped with ImageJ.
There is a folder Examples that contains:

  Directory of c:\Program Files (x86)\ImageJ\plugins\Examples

01/12/2015  01:38 PM    <DIR>          .
01/12/2015  01:38 PM    <DIR>          ..
10/04/2012  09:06 AM    <DIR>          -Macros
01/12/2015  01:34 PM    <DIR>          -moreStuff
10/04/2012  09:06 AM    <DIR>          -Scripts
10/29/2011  07:53 PM               716 Image_Inverter.class
10/29/2011  08:06 PM             1,387 Image_Inverter.java
10/29/2011  07:53 PM             3,400 IPDemoRunner.class
10/29/2011  07:53 PM             2,561 IP_Demo.class
10/29/2011  08:06 PM             5,059 IP_Demo.java
10/29/2011  07:53 PM             3,217 Plasma2_.class
10/29/2011  08:06 PM             3,311 Plasma2_.java
                7 File(s)         19,651 bytes

As you can see, I added a folder moreStuff and I moved the Red_And_Blue
plugin into it.

  Directory of c:\Program Files (x86)\ImageJ\plugins\Examples\-moreStuff

01/12/2015  01:34 PM    <DIR>          .
01/12/2015  01:34 PM    <DIR>          ..
10/29/2011  07:53 PM             1,037 Red_And_Blue.class
10/29/2011  08:06 PM               713 Red_And_Blue.java
                2 File(s)          1,750 bytes

I refresh menus and/or restart ImageJ and the -moreStuff folder still
does not appear as a subfolder of Examples. The -Macros and the -Scripts
folders do! and all their content is shown as it should.

Any help would be greatly appreciated. I am teaching a short course in
ImageJ next month and I would like to understand this detail.

I am using - ImageJ 1.49n and Java 1.7.0_03 (64-bit)


Thanks

Rich VanMetter

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Second-level Plug-in Menus

gankaku
Hi Richard,

I assume you are not working with a IDE like Eclipse. So here's a manual
way how to achieve what you want.
You can try to put your .class and your .java file together with a
"plugins.config" file into a final .jar-file:

The structure of your plugins.config file (a simple text file, you can
write this in any editor) would be:

Plugins>moreStuff, "Red And Blue", Red_And_Blue

You need to save the file with the exact name "plugins" and the extension
".config" next to your respective class and java files.

Then you go to the console, go to the directory where those three files are
in (this does not need to be the plugins folder) and type e.g.:

jar cf Red_And_Blue.jar *.class *.java *.config (This packs all .class and
.java file in this folder in the jar file, so if you have more than only
the one plugin in this folder you should specifically specify which files
to pack)

This will produce you an executable jar file which you can then put in the
plugins folder. In this case there is no need for a physical subdirectory
because your plugins.config file defines the menu structure in ImageJ.

In my case this works fine. If the cracks here around have a better, more
sophisticated way to do this I would also like to learn more ;-)

cheers,
Jan



--

CEO: Dr. rer. nat. Jan Brocher
phone:  +49 (0)6234 917 03 39
mobile: +49 (0)176 705 746 81
e-mail: [hidden email]
info: [hidden email]
inquiries: [hidden email]
web: www.biovoxxel.de

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Second-level Plug-in Menus

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Richard VanMetter
> On Jan 12, 2015, at 1:57 PM, Richard VanMetter <[hidden email]> wrote:
>
> Putting plug-ins in a second level menu is a useful feature that seems to work sometimes and not others. By not working, I mean that ImageJ simply ignores the second-level folder in \plugins or some of the plugins contained in that folder.  I have investigated, trying to find the trick to making it work, but without success. Perhaps someone can clarify it for me.
>
> Here's and example. Take the plugins that come shipped with ImageJ. There is a folder Examples that contains:
>
> Directory of c:\Program Files (x86)\ImageJ\plugins\Examples
>
> 01/12/2015  01:38 PM    <DIR>          .
> 01/12/2015  01:38 PM    <DIR>          ..
> 10/04/2012  09:06 AM    <DIR>          -Macros
> 01/12/2015  01:34 PM    <DIR>          -moreStuff
> 10/04/2012  09:06 AM    <DIR>          -Scripts
> 10/29/2011  07:53 PM               716 Image_Inverter.class
> 10/29/2011  08:06 PM             1,387 Image_Inverter.java
> 10/29/2011  07:53 PM             3,400 IPDemoRunner.class
> 10/29/2011  07:53 PM             2,561 IP_Demo.class
> 10/29/2011  08:06 PM             5,059 IP_Demo.java
> 10/29/2011  07:53 PM             3,217 Plasma2_.class
> 10/29/2011  08:06 PM             3,311 Plasma2_.java
>               7 File(s)         19,651 bytes
>
> As you can see, I added a folder moreStuff and I moved the Red_And_Blue plugin into it.

It will work if you create a MoreStuff folder directly in the plugins folder (ImageJ/plugins/MoreStuff) and copy Red_And_Blue.class into it. To create a Plugins>Examples>MoreStuff>Red And Blue command, you will need to package Red_And_Blue.class in a jar file along with a plugins.config file containing the line

   Plugins>Examples>MoreStuff, "Red And Blue", Red_And_Blue

Unlike plugins, macros and scripts can be installed in a second level folder. For example, you can create a Plugins>Examples>MoreStuff/Red And Blue command by writing  a macro named Red_And_Blue.ijm and saving it in the ImageJ/plugins/Examples/MoreStuff folder.

-wayne

>
> Directory of c:\Program Files (x86)\ImageJ\plugins\Examples\-moreStuff
>
> 01/12/2015  01:34 PM    <DIR>          .
> 01/12/2015  01:34 PM    <DIR>          ..
> 10/29/2011  07:53 PM             1,037 Red_And_Blue.class
> 10/29/2011  08:06 PM               713 Red_And_Blue.java
>               2 File(s)          1,750 bytes
>
> I refresh menus and/or restart ImageJ and the -moreStuff folder still does not appear as a subfolder of Examples. The -Macros and the -Scripts folders do! and all their content is shown as it should.
>
> Any help would be greatly appreciated. I am teaching a short course in ImageJ next month and I would like to understand this detail.
>
> I am using - ImageJ 1.49n and Java 1.7.0_03 (64-bit)
>
>
> Thanks
>
> Rich VanMetter

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