From a1be3e518f88098c12c0d4b78449b5bb32e021d9 Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Thu, 1 May 2025 14:14:34 +0000 Subject: [PATCH] Apply 2 suggestion(s) to 1 file(s) Co-authored-by: Julian Stirling --- src/openflexure_microscope_server/things/smart_scan.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 81f2158b..e2416c03 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -979,7 +979,7 @@ class SmartScanThing(Thing): raise HTTPException(404, "File not found") @_scan_running - def _preview_stitch_start(self, overlap: float = 0.1) -> None: + def _preview_stitch_start(self, overlap: float) -> None: """Start stitching a preview of the scan in a background subprocess @@ -989,6 +989,9 @@ class SmartScanThing(Thing): - self._preview_stitch_popen_lock is a lock aquired while interacting with Popen """ + # Set minimum overlap to 90% of the scan overlap to catch only images directly adjacent, + # not images with overlapping corners. + min_overlap = round(overlap * 0.9, 2) if self._preview_stitch_running(): raise RuntimeError("Only one subprocess is allowed at a time") with self._preview_stitch_popen_lock: @@ -998,7 +1001,7 @@ class SmartScanThing(Thing): "--stitching_mode", "only_stage_stitch", "--minimum_overlap", - f"{round(overlap * 0.9, 2)}", + f"{min_overlap}", self._ongoing_scan_images_dir, ] )