Skip to content

IJ.run() can start the legacy SPIM_Registration plugin instead of BigStitcher / multiview-reconstruction #158

Open

Description

@CellKai

Summary

Several commands that imcflibs.imagej.bdv runs through IJ.run() are registered under the
same menu name by two plugins:

  • multiview-reconstruction (MVR) / BigStitcher (current), and
  • the legacy SPIM_Registration plugin (classes spim.fiji.plugin.*).

IJ.run() resolves a command by its name only, so which plugin runs depends on the Fiji installation.
In a current "Fiji latest" installation this started the legacy plugin, which fails.

Observed

Fiji "latest" (2026-10-14) with multiview-reconstruction 9.0.11 / BigStitcher 3.0.8, headless:

IJ.run("Register Dataset based on Interest Points", "select=[...] ...")
java.lang.VerifyError: Bad type on operand stack
  Location: spim/fiji/plugin/Interest_Point_Registration.setFixedTilesAndReference(...)

i.e. spim.fiji.plugin.Interest_Point_Registration (SPIM_Registration) ran, not
net.preibisch.mvrecon.fiji.plugin.Interest_Point_Registration (MVR).

Who ships SPIM_Registration

update site file note
Fiji-Latest (core, https://sites.imagej.net/Fiji/) plugins/SPIM_Registration-5.0.26.jar full legacy plugin; declared as a dependency of jars/bigdataviewer_fiji-6.4.1.jar and plugins/Descriptor_based_registration-3.0.3.jar
BigStitcher (https://sites.imagej.net/BigStitcher/) plugins/SPIM_Registration-0.0.1.jar empty stub that replaces the legacy jar (presumably to avoid exactly this)

Which one ends up installed depends on the enabled update sites and their order. In the Fiji above
the full 5.0.26 jar was installed (Fiji-Latest listed after BigStitcher). Deleting the jar by hand
is not a fix: the updater reinstalls it, and other plugins depend on it.

Where the jars sit matters as well: with MVR in plugins/ (older installations) the MVR command
won, with MVR in jars/ (Fiji latest) the legacy one did.

Colliding command names

From the plugins.config of SPIM_Registration-5.0.26.jar vs. multiview-reconstruction-9.0.11.jar
/ BigStitcher-3.0.8.jar (bold = used by imcflibs.imagej.bdv):

  • Apply Transformations
  • Define Bounding Box
  • Define Multi-View Dataset
  • Detect Interest Points for Registration
  • Display View
  • Duplicate Transformations
  • Register Dataset based on Interest Points
  • Remove Detections by Distance
  • Specify Calibration
  • Visualize Detections

The stitching commands ("Calculate pairwise shifts ...", "Filter pairwise shifts ...", "Optimize
globally and apply shifts ...") and "Image Fusion" do not collide today.

Proposed fix

Start the plugin by its class instead of its menu name, handing over the macro options the way
IJ.run() does:

thread = Thread.currentThread()
if not thread.getName().startswith("Run$_"):  # IJ only passes options to such threads
    thread.setName("Run$_" + thread.getName())
Macro.setOptions(thread, options)
try:
    IJ.runPlugIn(command, "net.preibisch.mvrecon.fiji.plugin.Interest_Point_Registration", "")
finally:
    Macro.setOptions(thread, None)

with a map command name -> class for all MVR / BigStitcher commands used by the wrappers (the class
names are unchanged from MVR 7.0.7 to 9.0.11). Further benefits: independent of menu labels, and a
missing plugin fails with a clear error instead of "Unrecognized command". Cost: the class map has
to follow renames in MVR / BigStitcher.

A pull request implementing this as imcflibs.imagej.bdv.run_command() follows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions