ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

Figure_To_Pdf: use max plane size to select the appropriate zoom level #553

Closed sbesson closed 2 months ago

sbesson commented 2 months ago

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.

2024-04-19 11:34:23,564 INFO  [        ome.services.util.ServiceHandler] (rver-19469)  Meth:    interface omeis.providers.re.RenderingEngine.renderCompressed
2024-04-19 11:34:23,564 INFO  [        ome.services.util.ServiceHandler] (rver-19469)  Args:    [Type: XY, z=0, t=0; Region: x=19428 y=13901 width=7142 height=5110, renderShapes=false, shapeIds=[]]
2024-04-19 11:34:23,564 INFO  [             omeis.providers.re.Renderer] (rver-19469) Using: 'omeis.providers.re.HSBStrategy' rendering strategy.

With this change included, using the same OMERO.figure configuration, the export script should select a smaller resolution level with width and height both being smaller than 3k by default e.g.

2024-04-19 11:34:59,931 INFO  [        ome.services.util.ServiceHandler] (rver-19467)  Meth:    interface omeis.providers.re.RenderingEngine.renderCompressed
2024-04-19 11:34:59,931 INFO  [        ome.services.util.ServiceHandler] (rver-19467)  Args:    [Type: XY, z=0, t=0; Region: x=4857 y=3475 width=1785 height=1277, renderShapes=false, shapeIds=[]]
2024-04-19 11:34:59,931 INFO  [             omeis.providers.re.Renderer] (rver-19467) Using: 'omeis.providers.re.HSBStrategy' rendering strategy.

As a side-effect, this significantly reduces the size of the exported PDF

will-moore commented 2 months ago

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. All images were the same size testing with/without this PR except where the image was over 3k x 3k. E.g. without this PR an image was exported at 6062 × 2853 pixels, but with this PR it was 3031 × 1426.