Skip to content

bdv wrappers for multiview-reconstruction 9 / BigStitcher 3 - #161

Open
CellKai wants to merge 5 commits into
imcf:develfrom
CellKai:mvr9-bdv-wrappers-pr
Open

CellKai wants to merge 5 commits into
imcf:develfrom
CellKai:mvr9-bdv-wrappers-pr

Conversation

@CellKai

@CellKai CellKai commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #158
Fixes #159
Related: #160

Target: devel. Branch based on devel (8482d1a).

Changes (imcflibs.imagej.bdv)

  • run_command: MVR / BigStitcher commands are started by plugin class, so the legacy
    SPIM_Registration plugin can no longer take over a command (see IJ.run() can start the legacy SPIM_Registration plugin instead of BigStitcher / multiview-reconstruction #158). All MVR / BigStitcher
    wrappers use it; outside Fiji (test mocks) it falls back to IJ.run.
  • Dialog keys and choices match MVR 9.0.11 / BigStitcher 3.0.8 (see the table in imcflibs.imagej.bdv wrappers do not match multiview-reconstruction 9 / BigStitcher 3 #159).
  • New optional parameters, defaults keep the previous behaviour:
    • interest_points_registration: label, transformation and regularisation, groupings and merge
      distance, view / point selection, descriptor values, search radius, RANSAC options (new helper
      fmt_ransac_options), global optimisation strategy, fixed views, pre-alignment
    • optimize_and_apply_shifts: strategy, fixed groups, pre-alignment
    • detect_interest_points: label, downsampling, fixed intensity range, groupings
    • fuse_dataset: bounding box, preserve_original, non-rigid fusion, TIFF file name, N5 /
      OME-ZARR container name, compression, block sizes, compute-block factor (= shard size), pyramid
      levels, sharding, single container
    • stitching steps: backup_xml (default True)
  • fuse_dataset default export is TIFF (uncompressed); HDF5 is not available in MVR 9 and
    raises a ValueError. N5 and OME-ZARR (v3, helper export_choice) always write a BDV/BigStitcher
    XML and a multi-resolution pyramid. Compression and block sizes are always passed (MVR's initial
    defaults), because MVR's dialogs keep the values of the previous call for the rest of the Fiji
    session. Other wrappers only pass what they set; whether all wrappers should always pass every
    value is open in MVR / BigStitcher dialogs reuse the previous call's values within a Fiji session #160.
  • imcflibs.imagej.bdv imports without the PTBIOP update site (BIOP command imported in
    fuse_dataset_bdvp only).

Behaviour changes for existing callers: fuse_dataset() without export now writes TIFF
instead of (no longer possible) HDF5; ProcessingOptions timepoint strings changed (they did not
match the dialogs before).

Tests

  • tests/bdv/test_mvr_wrappers.py (mock-based string tests, 16 new tests); 65 tests pass, ruff check and markdownlint clean. The Python 2 job was not run locally.
  • Used in a registration / fusion pipeline (mesoSPIM whole-brain datasets) on Fiji latest with MVR
    9.0.11 / BigStitcher 3.0.8: offline on a synthetic BDV dataset (2 x 2 tiles, 2 channels, known
    shifts) the registration is identical to the previous MVR 7.0.7 pipeline (0.000 px) and the fused
    TIFFs are bit-identical; N5 / OME-ZARR export options verified in the written containers
    (compression, chunk and shard sizes, pyramid levels).

CellKai and others added 5 commits October 28, 2026 16:33
imcflibs.imagej.bdv could not be imported in a Fiji without the PTBIOP update
site (ImportError: No module named scijava), although only
fuse_dataset_bdvp needs the BIOP command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Checked against the dialogs of multiview-reconstruction 9.0.11 and
BigStitcher 3.0.8:

- run MVR / BigStitcher commands by plugin class (run_command): the legacy
  SPIM_Registration plugin shipped with Fiji registers several of the same
  command names, and IJ.run may start it instead
- dialog keys and choices: RANSAC (minmal_number_of_inliers,
  "Normal (10,000)", advanced options), search radius only with
  limit_search_radius, timepoint spelling, illumination key of the manual
  definition, pre-align, fusion export keys; HDF5 export (removed in MVR 9)
  raises, TIFF is the default
- new optional parameters, defaults keep the previous behaviour: registration
  (model, regularisation, grouping, point selection, descriptor values,
  search radius, RANSAC, strategy, fixed views), stitching optimisation
  (strategy, fixed groups), detection (label, downsampling, intensity range,
  grouping), fusion (bounding box, non-rigid, N5 / OME-ZARR options, file
  names), backup_xml for the stitching steps
- new helpers fmt_ransac_options and export_choice

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 16:53
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.72340% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 37%. Comparing base (8482d1a) to head (12e77ce).

Files with missing lines Patch % Lines
src/imcflibs/imagej/bdv.py 79% 20 Missing ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           devel   #161   +/-   ##
====================================
+ Coverage     33%    37%   +4%     
====================================
  Files         25     25           
  Lines       1806   1878   +72     
====================================
+ Hits         591    689   +98     
+ Misses      1215   1189   -26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Detection and registration labels containing spaces are not preserved, and the class-based plugin dispatch lacks tests for option handling and cleanup on success and failure.

3 open issues
What changed in this PR

Updates imcflibs.imagej.bdv for multiview-reconstruction 9 and BigStitcher 3, addressing legacy plugin command collisions (#158) and outdated dialog options (#159).

Changes:

  • Dispatches mapped commands by plugin class and defers the optional BIOP import.
  • Expands registration, detection, stitching, and fusion options; defaults fusion to TIFF and supports N5/OME-ZARR exports.
  • Adds mock-based wrapper tests and documents compatibility and behavior changes.
File Description
tests/​bdv/​test_mvr_wrappers.py Adds macro-string tests for updated wrappers and export options.
tests/​bdv/​test_definitionoptions.py Updates expectations for the illumination dialog key.
src/​imcflibs/​imagej/​bdv.py Implements class-based dispatch, corrected dialog options, and expanded wrapper parameters.
CHANGELOG.md Documents new helpers, compatibility fixes, and changed defaults.

Review effort: Balanced

Comment on lines +94 to +98
Macro.setOptions(thread, str(options))
try:
IJ.runPlugIn(command, class_name, "")
finally:
Macro.setOptions(thread, None)
Comment on lines +1440 to +1442
+ "label_interest_points="
+ label
+ " "
Comment on lines +1682 to +1684
+ "interest_points="
+ label
+ " "

This branch has not been deployed

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

Labels

None yet

Projects

None yet

2 participants