Merge branch 'stitching-two' into 'v3'

Stitch 2 images

See merge request openflexure/openflexure-microscope-server!630
This commit is contained in:
Joe Knapper 2026-06-30 17:31:00 +00:00
commit f35ad17449
4 changed files with 18 additions and 9 deletions

View file

@ -406,9 +406,8 @@ class SmartScanThing(OFMThing):
if self._preview_stitcher is None:
# This scan can't stitch.
return
# Assume 4 images means at least one offset in x and y, making the stitching
# well constrained.
if self.scan_data.image_count > 3 and not self._preview_stitcher.running:
# Begin stitching once two images are captured
if self.scan_data.image_count >= 2 and not self._preview_stitcher.running:
self._preview_stitcher.start()
@_scan_running
@ -543,8 +542,8 @@ class SmartScanThing(OFMThing):
@_scan_running
def _perform_final_stitch(self) -> None:
"""Update the scan zip and perform final stitch of the data."""
if self.scan_data.image_count <= 3:
self.logger.info("Not performing a stitch as 3 or fewer images taken")
if self.scan_data.image_count <= 1:
self.logger.info("Not performing a stitch as not enough images captured")
return
self.ongoing_scan.zip_files()
@ -758,6 +757,6 @@ class SmartScanThing(OFMThing):
# Use the scan list (the data read by the gallery) to find any scans that
# need stitching.
for scan in self.get_data_for_gallery():
if scan.dzi is None:
if scan.dzi is None and scan.number_of_images >= 2:
self.logger.info(f"Stitching {scan.name}")
self.stitch_scan(scan_name=scan.name)