Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export issue when the lowest resolution is greater than the max plane size #604

Open
sbesson opened this issue Dec 5, 2024 · 0 comments

Comments

@sbesson
Copy link
Member

sbesson commented Dec 5, 2024

The issue can be simulated with a synthetic image with the following dimensions

$ cat test.fake.ini 
sizeX=100000
sizeY=100000
resolutions=5

After importing this image into OMERO, creating a figure and trying to export it, the script fails with the following error:

Traceback (most recent call last):
  File "./script", line 2562, in <module>
    run_script()
  File "./script", line 2548, in run_script
    file_annotation = export_figure(conn, script_params)
  File "./script", line 2504, in export_figure
    return fig_export.build_figure()
  File "./script", line 980, in build_figure
    self.add_panels_to_page(panels_json, image_ids, page)
  File "./script", line 1988, in add_panels_to_page
    image, pil_img = self.draw_panel(panel, page, i)
  File "./script", line 1809, in draw_panel
    pil_img = self.get_panel_image(image, panel, orig_name)
  File "./script", line 1707, in get_panel_image
    pil_img = self.get_panel_big_image(image, panel)
  File "./script", line 1643, in get_panel_big_image
    pil_img = self.render_big_image_region(image, panel, z, t,
  File "./script", line 1563, in render_big_image_region
    scale, level = self.get_zoom_level_scale(image, region, max_width)
  File "./script", line 1548, in get_zoom_level_scale
    zm_levels[zm] * width * zm_levels[zm] * height > max_plane):
KeyError: 5

The logic in

while (zm < max_level and
zm_levels[zm] * width > max_width or
zm_levels[zm] * width * zm_levels[zm] * height > max_plane):
zm = zm + 1

assumes that a resolution lower than the maximum plane size will be found which is incorrect. Minimally this should be updated to handle the case where the lowest resolution is greated than 3kx3k in a default configuration.

This raises the question of the how the export script and more generally the application should behave in these scenarios. One approach would be to use tile render calls rather than plane calls but this might be a larger effort. Another option would be to block render calls with an informative error message when the lowest resolution is larger than the maximum plane size similarly to what was done in #560 for maximum projection.

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

No branches or pull requests

1 participant