-
Notifications
You must be signed in to change notification settings - Fork 31
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
Figure_To_Pdf: use max plane size to select the appropriate zoom level #553
Conversation
The logic selecting the best resolution for the export can select a plane as large as omero.client.download_as.max_size. With a default value of 144000000, this means regions as wide as 12k x 12k can be requested to the server. This commit proposes to use the max plane width and height instead to select the appropriate resolution level. Both configurations default to 3k and are already used for identifying an image as "big" and navigating through the resolution levels.
|
||
# start big, and go until we reach target size | ||
zm = 0 | ||
while (zm < max_level and | ||
zm_levels[zm] * width > max_width or | ||
zm_levels[zm] * width * zm_levels[zm] * height > max_plane): | ||
zm_levels[zm] * width > max_sizes[0] or | ||
zm_levels[zm] * height > max_sizes[1]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By comparing width and height separately you get a more conservative (smaller) image, E.g. if your image width is 3 x the height, then the plane size you get will be 1/3 of the big image cut-off.
Alternatively you could leave this logic unchanged and do max_plane = max_sizes[0] * max_sizes[1]
above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 7d25b9f. This is consistent with the way plane sizes are used in is_big_image
above
omero-figure/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
Lines 1526 to 1529 in 87d179a
def is_big_image(self, image): | |
"""Return True if this is a 'big' tiled image.""" | |
max_w, max_h = self.conn.getMaxPlaneSize() | |
return image.getSizeX() * image.getSizeY() > max_w * max_h |
but also server-side to indicate the requirement of pyramidal levels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks 👍
Tested locally, exporting a figure containing big SVS image panels at various zoom levels, using the export to "PDF and Images" to generate a zip containing the original rendered images. |
The logic selecting the best resolution for the export can select a plane as large as omero.client.download_as.max_size. With a default value of 144000000, this means regions as wide as 12k x 12k can be requested to the server.
This commit proposes to use the max plane width and height instead to select the appropriate resolution level. Both configurations default to 3k and are already used for identifying an image as "big" and navigating through the resolution levels.
This PR should be tested by running the figure export workflow on a large pyramidal images. Adjust the zoom so that the width & height is in the 3k-10k range and run the figure export script.
The server logs should include the arguments passed to the
rednderCompressed
API e.g.With this change included, using the same OMERO.figure configuration, the export script should select a smaller resolution level with
width
andheight
both being smaller than 3k by default e.g.As a side-effect, this significantly reduces the size of the exported PDF