Skip to content

Comments

Update imgData endpoint to return more metadata about the resolutions#653

Merged
knabar merged 1 commit intoome:masterfrom
sbesson:imgData_resolution_descriptions
Feb 6, 2026
Merged

Update imgData endpoint to return more metadata about the resolutions#653
knabar merged 1 commit intoome:masterfrom
sbesson:imgData_resolution_descriptions

Conversation

@sbesson
Copy link
Member

@sbesson sbesson commented Jan 14, 2026

Fixes #584

The response to the webgateway/imgData endpoint uses ImageWrapper.getZoomLevelScaling which reduces the resolution description as a one dimensional array of scalar zoom levels.
This reduction suffers from limitations both due to rounding errors as well as resolution levels where sizeX and sizeY might have different zoom level scaling.
This commit marshals the sizeX/sizeY pair returned from PixelBuffer.getResolutionDescriptions into a new dictionary for all resolutions and returns it as an additional resolutions field in the JSON response for multi-resolution images.

The proposed value of the resolutions attribute mirrors zoomLevelScaling by using a dictionary where each key is the resolution index and only being populated for images with more than one resolution. As a possible discussion point, resolutions could be populated for all images independently of the number of resolution level.

/cc @melissalinkert @kkoz

The response to this endpoint uses `ImageWrapper.getZoomLevelScaling` which
reduces the resolution description as a one dimensional array of scalar
zoom levels.
This reduction suffers from limitations both due to rounding errors as
well as resolution levels where sizeX and sizeY might have different zoom
level scaling.
This commit marshals the sizeX/sizeY pair returned from
PixelBuffer.getResolutionDescriptions into a new dictionary for all resolutions
and returns it as an additional `resolutions` field in the JSON response
for multi-resolution images.
@sbesson sbesson requested review from knabar and mabruce January 14, 2026 11:47
@sbesson
Copy link
Member Author

sbesson commented Jan 14, 2026

Once the initial draft has been validated by the nightly CI builds to confirm there is no regression, the plan is to extend the https://github.com/ome/openmicroscopy/blob/develop/components/tools/OmeroWeb/test/integration/test_marshal.py integration. test to cover the multi-resolution scenario in addition to the simple small multi-dimensional image.

@knabar
Copy link
Member

knabar commented Jan 14, 2026

Will this change the behavior of zoomLevelScaling? Currently for images with a single level, zoomLevelScaling is None, whereas now it will be a dictionary with one entry.

Clients that check for the existence of a zoomLevelScaling value may have to be adjusted.

Could we alternatively keep the current zoomLevelScaling and populate a new entry instead?

@sbesson
Copy link
Member Author

sbesson commented Jan 14, 2026

No, the intent of this is to be 100% backwards-compatible although zoomLevelScaling is effectively made redundant by the resolutions attribute as the client could use its value to calculate the scaling.

My reading of the current implementation is that for single-resolution images, the tiles boolean will be False and the zoomLevelScaling population will be skipped altogether as per

levels = image._re.getResolutionLevels()
tiles = levels > 1
rv["tiles"] = tiles
if tiles:
. This is also what is being tested in https://github.com/ome/openmicroscopy/blob/0763546fbc345dbc1bbcf1995bd9d631f5ba1567/components/tools/OmeroWeb/test/integration/test_marshal.py#L52-L55

@will-moore
Copy link
Member

The test has assert 'zoomLevelScaling' not in img_data but with this PR, img_data will always contain zoomLevelScaling.

I understand we don't want to call _re.getResolutionDescriptions() more than once, but if there's only a single item then don't set zoomLevelScaling

@knabar
Copy link
Member

knabar commented Jan 14, 2026

My reading of the current implementation is that for single-resolution images, the tiles boolean will be False and the zoomLevelScaling population will be skipped altogether as per

After another reading I agree, the presence of zoomLevelScaling should not change. If tests pass, 👍 from me.

@jburel
Copy link
Member

jburel commented Jan 20, 2026

Tests are green

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link

@mabruce mabruce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.

@knabar knabar merged commit 41013d3 into ome:master Feb 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the resolution descriptions of the imgData endpoint

5 participants