From 279055108fc03107b09754308d663be1da41779b Mon Sep 17 00:00:00 2001 From: jaknapper Date: Thu, 7 Aug 2025 18:26:27 +0100 Subject: [PATCH 1/4] Set final stitch tile size to 4096px --- src/openflexure_microscope_server/stitching.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/stitching.py b/src/openflexure_microscope_server/stitching.py index b88c4036..b0721dc8 100644 --- a/src/openflexure_microscope_server/stitching.py +++ b/src/openflexure_microscope_server/stitching.py @@ -19,6 +19,7 @@ from openflexure_microscope_server.utilities import make_path_safe STITCHING_CMD = "openflexure-stitch" STITCHING_RESOLUTION = (820, 616) +STITCH_TILE_SIZE = 4096 DEFAULT_OVERLAP = 0.1 DEFAULT_RESIZE = 0.5 @@ -207,7 +208,12 @@ class FinalStitcher(BaseStitcher): self._mode = "all" 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( self, From 7cedd31ff4dc2ec366262ee15358ce732816d9e6 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Fri, 8 Aug 2025 10:43:54 +0100 Subject: [PATCH 2/4] Default tile size 8192 --- src/openflexure_microscope_server/stitching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/stitching.py b/src/openflexure_microscope_server/stitching.py index b0721dc8..9ef7561f 100644 --- a/src/openflexure_microscope_server/stitching.py +++ b/src/openflexure_microscope_server/stitching.py @@ -19,7 +19,7 @@ from openflexure_microscope_server.utilities import make_path_safe STITCHING_CMD = "openflexure-stitch" STITCHING_RESOLUTION = (820, 616) -STITCH_TILE_SIZE = 4096 +STITCH_TILE_SIZE = 8192 DEFAULT_OVERLAP = 0.1 DEFAULT_RESIZE = 0.5 From f9f28b35003884ab88bbabc073150d3f711c85f8 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Fri, 8 Aug 2025 10:44:03 +0100 Subject: [PATCH 3/4] Update tests --- tests/test_stitching.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_stitching.py b/tests/test_stitching.py index ef248b82..d4908340 100644 --- a/tests/test_stitching.py +++ b/tests/test_stitching.py @@ -78,6 +78,8 @@ FINAL_EXPECTED_COMMAND = [ "all", "--stitch_dzi", "--no-stitch_tiff", + "--tile_size", + "8192", "--minimum_overlap", "0.09", "--resize", @@ -117,8 +119,8 @@ def test_final_stitcher_command_set_val_directly(): """Check that values are set as expected when directly input.""" # Modify defaults expected_command = copy(FINAL_EXPECTED_COMMAND) - expected_command[6] = "0.36" - expected_command[8] = "0.25" + expected_command[8] = "0.36" + expected_command[10] = "0.25" # Test with no data dictionary, irrelevant data, and also the wrong data # When wrong data is submitted, it should take the directly input data. 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.""" # Modify defaults expected_command = copy(FINAL_EXPECTED_COMMAND) - expected_command[6] = "0.36" - expected_command[8] = "0.25" + expected_command[8] = "0.36" + expected_command[10] = "0.25" # 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 = [dim * 4 for dim in STITCHING_RESOLUTION] From c64fa4e05b9ca785c5fefb3008ef3d527052a2b7 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Fri, 8 Aug 2025 10:49:05 +0100 Subject: [PATCH 4/4] Update stitching to 0.2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c045fdf1..e833c274 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ "sangaboard", "camera-stage-mapping ~= 0.1.10", "opencv-python ~= 4.11.0", - "openflexure-stitching[libvips]==0.1.0", + "openflexure-stitching[libvips]==0.2.0", "pillow ~= 10.4", "anyio ~= 4.0", "numpy ~= 2.2",