Getting plugin tool to work with ImageJ2

plugin
imagej2
roi
Tags: #<Tag:0x00007fd541fce3b0> #<Tag:0x00007fd541fce220> #<Tag:0x00007fd541fce0b8>

#1

I’ve been trying to get a plugin in tool to work. I copied one of the plugin tools from the imagej-plugins-tools source code and did some modifications, added a new icon, changed the names, added a main section to run imageJ2. The tool loads onto the toolbar, but some of the functionality is broken for all of the tools. For example, you can’t get the configure dialog box to appear. The code also seems to run very slow. I then tried to add the plug-in to a downloaded copy of imageJ2 and it does work. It shows up as being added when I get the system information and scroll through the plugins. On top of that, NONE of the plugins in imageJ2 are actually imageJ2 plugins. They all seem to be imageJ1 plugins.

I wanted to develop the plugin (and even tackle dealing with immature overlays) because the full scope of the project needs to handle adding specialized file I/O. It needs to be a tool because we want to display statistics for the region of pixels that is under the cursor. But now I’m thinking this is too bleeding edge.

Any suggestions what I need to do to get the plugin tool to work with a downloaded copy? or do I have to build a “pure” imageJ2.

I have now tried to get an imageJ1 style of plugin to run (the overlay brush is a good starting point for what I want). I can compile and run the plugin in eclipse if I force the plugin to run by adding a main method and having the method call the plugin. But I can’t seem to get it to install in imageJ2. I then thought I would just compile and run it from imageJ2. But that gives me the dreaded AWT version 52 found and needs version 50 (java 1.6 vs. java 1.8)…which doesn’t seem to be an easy fix. At least not easy enough to distribute the plugin to engineers to use.

Any suggestions on how to get a plugin tool to work would be greatly appreciated


#2

Dear @Neil,

welcome to the forum! :slight_smile:

A right click on e.g. the Flood Fill tool does not open up a configuration dialog in your case? We will need to investigate this since I can’t reproduce the issue here.

How did you notice that? Are you talking about UI code or computations that the tool is doing?

Could you provide an example of that issue since I am not entirely sure I have understood the issue?

You can use ImageJ1’s ij.Overlay in the meantime, if you are not totally keen on keeping everything ImageJ2.

Images or some other kind of data?

Is your source code on GitHub / publicly accessible? It would be really helpful to get an idea of your project setup and figure out a way to fix your issues. If you are concerned about IP stuff, you could remove the computations from the code and re-add it afterward.

Best,
Stefan


#3

Some how the plugin.config file was not copied over when I used an existing plugin as a template to start with. With no plugin.config, when you install the plugin to a working copy, it doesn’t show up in any of the menus. All I was trying to do was take the overlay brush tool that started shipping with imageJ 1.46 and had source code posted on the NIH website and get the flow to work. With the correct plugin.config, the tool plugin will work.

I then tried to update a imageJ2 style of tool plugin. It shows up on the menus, but does do anything when installed. The plugin works okay when running from eclipse. This was the style that operated very slowly. That is, drawing consisted of line segments instead of a smooth curve. I copied the PencilTool source files to create that project. Interesting, it didn’t show up in the menus until I added an underscore to the name even though it’s an imageJ2 style of plugin.


#4

If you are developing an ImageJ plugin and you package your project as JAR file, then you’ll need a plugins.config file at the correct location. If you are putting a compiled *.class file with an underscore into the plugins folder of an ImageJ instance and somehow implement PlugIn, that should get picked up even without a plugins.config.

Did you start ImageJ2 in “modern mode” or switch to it explicitly (Help > Switch to modern mode)? A custom tool shows up for me in the toolbar even without an underscore. It does, however, not show up in the menus, if that was your goal.

Uploading your little test project to GitHub would make troubleshooting a lot easier.