From 5811631c4f9a182dbfeb4f895ceb48abe2999f5c Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Mon, 29 Jun 2026 12:21:32 +0100 Subject: [PATCH] Stitch 2 images --- .../things/smart_scan.py | 11 +++++------ .../galleryComponents/galleryCard.vue | 2 +- .../tabContentComponents/galleryContent.vue | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index d22cb55f..df511795 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -385,9 +385,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 @@ -522,8 +521,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() @@ -737,6 +736,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) diff --git a/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue b/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue index 1d69591b..f53e93be 100644 --- a/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue +++ b/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue @@ -62,7 +62,7 @@
  • Duration: {{ formatDuration(itemData.duration) }}