@@ -406,6 +406,8 @@ def _register_grid_square(
406406 and atlas_entry .x1 is not None
407407 and atlas_entry .y0 is not None
408408 and atlas_entry .y1 is not None
409+ and atlas_entry .thumbnail_pixels_x is not None
410+ and atlas_entry .thumbnail_pixels_y is not None
409411 ):
410412 atlas_width_real = atlas_entry .x1 - atlas_entry .x0
411413 atlas_height_real = atlas_entry .y1 - atlas_entry .y0
@@ -420,34 +422,31 @@ def _register_grid_square(
420422 and clem_img_series .x1 is not None
421423 and clem_img_series .y0 is not None
422424 and clem_img_series .y1 is not None
423- and clem_img_series .thumbnail_pixels_x is not None
424- and clem_img_series .thumbnail_pixels_y is not None
425- and clem_img_series .thumbnail_pixel_size is not None
426425 ):
427426 # Find pixel corresponding to image midpoint on atlas
428427 x_mid_real = (
429428 0.5 * (clem_img_series .x0 + clem_img_series .x1 ) - atlas_entry .x0
430429 )
431430 x_mid_px = int (
432- x_mid_real / atlas_width_real * clem_img_series .thumbnail_pixels_x
431+ x_mid_real / atlas_width_real * atlas_entry .thumbnail_pixels_x
433432 )
434433 y_mid_real = (
435434 0.5 * (clem_img_series .y0 + clem_img_series .y1 ) - atlas_entry .y0
436435 )
437436 y_mid_px = int (
438- y_mid_real / atlas_height_real * clem_img_series .thumbnail_pixels_y
437+ y_mid_real / atlas_height_real * atlas_entry .thumbnail_pixels_y
439438 )
440439
441- # Find the size of the image, in pixels, when overlaid the atlas
440+ # Find the size of the image, in pixels, when overlaid on the atlas
442441 width_scaled = int (
443442 (clem_img_series .x1 - clem_img_series .x0 )
444443 / atlas_width_real
445- * clem_img_series .thumbnail_pixels_x
444+ * atlas_entry .thumbnail_pixels_x
446445 )
447446 height_scaled = int (
448447 (clem_img_series .y1 - clem_img_series .y0 )
449448 / atlas_height_real
450- * clem_img_series .thumbnail_pixels_y
449+ * atlas_entry .thumbnail_pixels_y
451450 )
452451 else :
453452 logger .warning (
0 commit comments