Merge branch 'stitch-tile-size' into 'v3'

Update to stitching 0.2

See merge request openflexure/openflexure-microscope-server!352
This commit is contained in:
Julian Stirling 2025-08-08 10:29:43 +00:00
commit 3d7438ed2b
3 changed files with 14 additions and 6 deletions

View file

@ -22,7 +22,7 @@ dependencies = [
"sangaboard", "sangaboard",
"camera-stage-mapping ~= 0.1.10", "camera-stage-mapping ~= 0.1.10",
"opencv-python ~= 4.11.0", "opencv-python ~= 4.11.0",
"openflexure-stitching[libvips]==0.1.0", "openflexure-stitching[libvips]==0.2.0",
"pillow ~= 10.4", "pillow ~= 10.4",
"anyio ~= 4.0", "anyio ~= 4.0",
"numpy ~= 2.2", "numpy ~= 2.2",

View file

@ -19,6 +19,7 @@ from openflexure_microscope_server.utilities import make_path_safe
STITCHING_CMD = "openflexure-stitch" STITCHING_CMD = "openflexure-stitch"
STITCHING_RESOLUTION = (820, 616) STITCHING_RESOLUTION = (820, 616)
STITCH_TILE_SIZE = 8192
DEFAULT_OVERLAP = 0.1 DEFAULT_OVERLAP = 0.1
DEFAULT_RESIZE = 0.5 DEFAULT_RESIZE = 0.5
@ -207,7 +208,12 @@ class FinalStitcher(BaseStitcher):
self._mode = "all" self._mode = "all"
tiff_arg = "--stitch_tiff" if stitch_tiff else "--no-stitch_tiff" tiff_arg = "--stitch_tiff" if stitch_tiff else "--no-stitch_tiff"
self._extra_args = ["--stitch_dzi", tiff_arg] self._extra_args = [
"--stitch_dzi",
tiff_arg,
"--tile_size",
str(STITCH_TILE_SIZE),
]
def _process_inputs( def _process_inputs(
self, self,

View file

@ -78,6 +78,8 @@ FINAL_EXPECTED_COMMAND = [
"all", "all",
"--stitch_dzi", "--stitch_dzi",
"--no-stitch_tiff", "--no-stitch_tiff",
"--tile_size",
"8192",
"--minimum_overlap", "--minimum_overlap",
"0.09", "0.09",
"--resize", "--resize",
@ -117,8 +119,8 @@ def test_final_stitcher_command_set_val_directly():
"""Check that values are set as expected when directly input.""" """Check that values are set as expected when directly input."""
# Modify defaults # Modify defaults
expected_command = copy(FINAL_EXPECTED_COMMAND) expected_command = copy(FINAL_EXPECTED_COMMAND)
expected_command[6] = "0.36" expected_command[8] = "0.36"
expected_command[8] = "0.25" expected_command[10] = "0.25"
# Test with no data dictionary, irrelevant data, and also the wrong data # Test with no data dictionary, irrelevant data, and also the wrong data
# When wrong data is submitted, it should take the directly input data. # When wrong data is submitted, it should take the directly input data.
dict_vals = [ dict_vals = [
@ -141,8 +143,8 @@ def test_final_stitcher_command_set_with_dict():
"""Check that values are set as expected when set from a ScanData dictionary.""" """Check that values are set as expected when set from a ScanData dictionary."""
# Modify defaults # Modify defaults
expected_command = copy(FINAL_EXPECTED_COMMAND) expected_command = copy(FINAL_EXPECTED_COMMAND)
expected_command[6] = "0.36" expected_command[8] = "0.36"
expected_command[8] = "0.25" expected_command[10] = "0.25"
# Check same thing works with a dictionary, resize is calculated from the saved image # Check same thing works with a dictionary, resize is calculated from the saved image
# resolution. Make 4x bigger than STITCHING_RESOLUTION to get 0.25 # resolution. Make 4x bigger than STITCHING_RESOLUTION to get 0.25
resolution = [dim * 4 for dim in STITCHING_RESOLUTION] resolution = [dim * 4 for dim in STITCHING_RESOLUTION]