brainglobe / brainglobe-stitch

A napari plugin for stitching large tiled 3D imaging datasets
BSD 3-Clause "New" or "Revised" License
7 stars 0 forks source link

Call BigStitcher by command line and read the results #7

Closed IgorTatarnikov closed 3 months ago

IgorTatarnikov commented 4 months ago

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

Why is this PR needed? brainglobe-stitch will use BigStitcher to calculate the precise alignments for the tiles. We need a way to call BigStitcher from within brainglobe-stitch and then read in and utilise the results.

What does this PR do? This PR does three things:

  1. Adds a new function run_big_stitcher this calls BigStitcher using the command line to run bigstitcher_macro.ijm. bigstitcher_macro.ijm will call import the rough alignment from a file automatically generated when data is added to ImageMosaic and then refine the alignment. The final result is saved in the .xml file that's present in the mesoSPIM directory.

  2. Added a stitch function to ImageMosaic that calls the run_big_stitcher function from above and a read_big_stitcher_transforms function to read the results of running BigStitcher and update the positions of the tiles.

  3. Added a way to call the stitching functions from within the napari widget. The user must provide a path to a Fiji installation that already has BigStitcher installed.

NOTE: To run local tests you must install Fiji and also add BigStitcher to the update sites. This can be done using the GUI see here or via the command line after installing Fiji.

./ImageJ-linux64 --update add-update-sites "BigStitcherUpdate" "https://sites.imagej.net/BigStitcher/"
./ImageJ-linux64 --update update

Replace ImageJ-linux64 with the path to the local ImageJ executable.

How has this PR been tested?

This PR has been tested locally and new tests have been added that cover the features.

Three different datasets are available for testing:

  1. Tiny (~28 MB): this is mostly used for automated testing and doesn't work for visual inspection. It can be downloaded here.
  2. Small (~1.8 GB): this dataset is more useful for visual inspection. It can be downloaded here.
  3. A full size dataset is available (~130 GB): this dataset works best for testing overall performance, especially when reading or writing data. It's available by request.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

Yes, but not in this PR.

Checklist:

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 93.47826% with 9 lines in your changes missing coverage. Please review.

Project coverage is 96.89%. Comparing base (68f0d78) to head (8302bac). Report is 3 commits behind head on main.

Files Patch % Lines
brainglobe_stitch/file_utils.py 87.50% 5 Missing :warning:
brainglobe_stitch/image_mosaic.py 92.59% 2 Missing :warning:
brainglobe_stitch/stitching_widget.py 96.61% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7 +/- ## ========================================== - Coverage 98.60% 96.89% -1.71% ========================================== Files 5 6 +1 Lines 286 419 +133 ========================================== + Hits 282 406 +124 - Misses 4 13 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.