Removing "Upload Sample Image" from legacy menu of ij rc43/1.50f

Hi AlI, tried the entire sunday to get rid of the
Help>Upload Sample Image menu entry in the legacy menu of ImageJ2
rc43/1.50f and can’t figure out how the menu entry is generated when
even removing the SampleImageUploader.class has no effect. I am running a
stripped down version of ImageJ 1.50f for Raman spectroscopy and
changed to ImageJ2 because it works also with high dpi screens. In my
version the menu.class is edited to remove the help menu entirely, but
ImageJ2 won’t start without it. With an empty help menu it is fine
except I can’t get rid of the “Upload Sample Image”. I would be really
glad if you could outline how to do that.



The class containing that command is SampleImageUploader from imagej-plugins-commands.

You could try removing the jars/imagej-plugins-commands-X.Y.Z.jar file, although that may result in other desired commands being missing.

We made the decision to lump together core ImageJ2 commands into a single JAR file to avoid a level of modularity which some developers find excessive.

The downside is that if you want to customize the behavior of ImageJ2 with respect to that JAR file, you’ll need to create a stripped down version of it which removes the undesired plugins.

In the future, ImageJ2 will provide better support for menu shortcut customization, so that you can e.g. remove that menu entry even if the class is still present in the installation. But unfortunately that feature does not exist yet.

Thanks, Curtis. I removed the SampleImageUploader.class from the jars/imagej-plugins-commands-X.Y.Z.jar yesterday, but the menu did not change at all, so I thought the commands in the menus are defined at an other place. Why was the menu entry still there without the class in the jar in both legacy and modern?

I tried to change by removing the menu entry to “” but failed to compile it, it always gives an error about a class not found. (BufferedInputStream.class not found and wrong version).

Ah! I did not realize that’s what you meant.

The reason is that the plugin metadata is cached in each JAR file in the file META-INF/json/org.scijava.plugin.Plugin. To purge the plugin, edit that file to remove the JSON block describing the SampleImageUploader plugin.

Or simpler: clone the imagej-plugins-commands repository, delete the file, and then do a full rebuild with mvn clean package. Then you’ll have a consistent imagej-plugins-commands-X.Y.Z.jar file in the target/ subfolder.

1 Like

YEAH! That’s what I have been looking for and after editing org.scijava.plugin.Plugin the entry is gone. Great, many thanks for your help! Still, a customize menu function would be great…

1 Like