Skip to content

Commit 1cfb006

Browse files
committed
Included calculation of image dimensions (in pixels) as displayed on atlas
1 parent 41f533a commit 1cfb006

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/murfey/workflows/clem/register_preprocessing_results.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,18 @@ def _register_grid_square(
328328
0.5 * (clem_img_series.y0 + clem_img_series.y1) - atlas_entry.y0
329329
)
330330
y_mid_px = int(y_mid_real / atlas_height_real * atlas_entry.pixels_y)
331+
332+
# Find the number of pixels in width and height the image corresponds to on the atlas
333+
width_scaled = int(
334+
(clem_img_series.x1 - clem_img_series.x0)
335+
/ atlas_width_real
336+
* atlas_entry.pixels_x
337+
)
338+
height_scaled = int(
339+
(clem_img_series.y1 - clem_img_series.y0)
340+
/ atlas_height_real
341+
* atlas_entry.pixels_y
342+
)
331343
else:
332344
logger.warning(
333345
f"Image series {clem_img_series.series_name!r} not populated with required values"
@@ -342,7 +354,9 @@ def _register_grid_square(
342354
y_location=clem_img_series.y0,
343355
y_location_scaled=y_mid_px,
344356
height=clem_img_series.pixels_x,
357+
height_scaled=height_scaled,
345358
width=clem_img_series.pixels_y,
359+
width_scaled=width_scaled,
346360
x_stage_position=clem_img_series.x0,
347361
y_stage_position=clem_img_series.y0,
348362
pixel_size=clem_img_series.pixel_size,

0 commit comments

Comments
 (0)