Skip to content

Commit

Permalink
Don't lookup resolution levels for small images
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Feb 25, 2024
1 parent 1f190d3 commit 8bfba4c
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions omeroweb/webgateway/marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,22 +351,28 @@ def pixel_size_in_microns(method):
rv = None
raise

# big images
if load_re(image, rv):
levels = image._re.getResolutionLevels()
tiles = levels > 1
rv["tiles"] = tiles
if tiles:
width, height = image._re.getTileSize()
zoomLevelScaling = image.getZoomLevelScaling()
rv.update(
{"tile_size": {"width": width, "height": height}, "levels": levels}
)
if zoomLevelScaling is not None:
rv["zoomLevelScaling"] = zoomLevelScaling

if init_zoom < 0:
init_zoom = levels + init_zoom
# If image is big - need to load RE to get resolution levels
# NB: some small images like OME-Zarr can have pyramids
# but these will be ignored

# TEMP - for A/B testing only use size test if ID is odd number!
if image.id % 1 == 0 and not image.requiresPixelsPyramid():
rv["tiles"] = False
else:
if load_re(image, rv):
levels = image._re.getResolutionLevels()
tiles = levels > 1
rv["tiles"] = tiles
if tiles:
width, height = image._re.getTileSize()
zoomLevelScaling = image.getZoomLevelScaling()
rv.update(
{"tile_size": {"width": width, "height": height}, "levels": levels}
)
if zoomLevelScaling is not None:
rv["zoomLevelScaling"] = zoomLevelScaling
if init_zoom < 0:
init_zoom = levels + init_zoom
rv["init_zoom"] = init_zoom

if key is not None and rv is not None:
Expand Down

0 comments on commit 8bfba4c

Please sign in to comment.