From c2f1b591b1fcca0f391550e1cec3a69e8cde5ac7 Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Sat, 13 Jan 2024 14:29:34 +0000 Subject: [PATCH] Fix to CSM scaling for Fiji config as images are now captured at double width --- src/openflexure_microscope_server/things/smart_scan.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index ef8ac1fa..13b42bc0 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -148,6 +148,8 @@ def generate_config(folder_path: str, positions: list, names: list, camera_to_sa positions = np.array(positions) mean_loc = np.mean(positions, axis = 0) + #TODO: positions from recent scans need to be 2x bigger - change to CSM res? + camera_to_sample_matrix = scale_csm(camera_to_sample_matrix, csm_calibration_width, img_width) with open(os.path.join(folder_path, 'TileConfiguration.txt'), 'w') as fp: @@ -422,9 +424,6 @@ class SmartScanThing(Thing): # camera and stage may not be aligned). CSM = csm.image_to_stage_displacement_matrix csm_calibration_width = csm.last_calibration["image_resolution"][1] - - # TODO: this downsampling by two is to deal with a camera issue - img_width = int(arr.shape[1] / 2) overlap = self.overlap @@ -540,6 +539,8 @@ class SmartScanThing(Thing): width, height = img.size img = img.resize((int(width*0.5), int(height*0.5))) + img_width, _ = img.size + logger.info(f"Saving {name}") img.save( os.path.join(images_folder, name),