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

Additional export functionality #306

Closed knabar closed 5 years ago

knabar commented 6 years ago

This PR includes additional functionality for the PDF/TIFF export:

None of these changes should impact the current export behavior for a given figure, though I need to do some more thorough testing.

Especially shape label rendering will need some more work, but opening the PR now for early review.

jburel commented 6 years ago

Comparing both web-latest and web-merge No obvious regression in the exported figure I noticed a problem exporting as TIFF see screenshot (left export, right figure)

export_as_tiff
will-moore commented 6 years ago

Seems that the issue @jburel noticed above is due to this PR. Tried exporting same figure with script from origin/master (left) and then from this branch (right). NB: also noticed a truncation of the purple Polylline.

screen shot 2018-08-06 at 10 28 09

knabar commented 6 years ago

The truncation is due to the large stroke width and the temporary canvas used to draw on not having enough buffer around the shape. Should be easy to resolve once I get back.

On Aug 6, 2018, at 11:30 AM, Will Moore notifications@github.com wrote:

Seems that the issue @jburel noticed above is due to this PR. Tried exporting same figure with script from origin/master (left) and then from this branch (right). NB: also noticed a truncation of the purple Polylline.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

knabar commented 6 years ago

Rebased on top of 4.0.1 and fixed the offset/cropping issue when drawing polygons

jburel commented 6 years ago

@knabar is it ready for review?

knabar commented 6 years ago

@jburel Yes, apologies for not explicitly stating so

will-moore commented 5 years ago

This has fixed the issue we were seeing above. The only problem I'm seeing now is that the rectangle corners are rounded in TIFF export because of the way that we're drawing polygons.

For rotated rectangles (which we don't yet support in the web UI) it may be harder find a workaround so I guess it's OK to use the polygon method, but if there's no rotation then I think it would be nice to preserve the current behaviour.

I also tested with a rotated image (not rotated rectangles) and it's working fine:

screen shot 2018-09-17 at 10 32 47

knabar commented 5 years ago

@will-moore Thanks. I'll check out the rectangle issue to see if there's an easy fix for both unrotated and rotated.

knabar commented 5 years ago

Apparently yesterday a PR was merged into Pillow to draw nicer polyline joints, but they chose rounded joints also: https://github.com/python-pillow/Pillow/pull/3250

knabar commented 5 years ago

@will-moore @jburel I changed rectangle drawing for Pillow back to a custom method to get squared corners. Ready for another review.

screen shot 2018-09-17 at 17 45 50
will-moore commented 5 years ago

This is working nicely for me now. But travis is complaining:

./omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py:669:5: E303 too many blank lines (2)

Otherwise, good to merge.

knabar commented 5 years ago

@will-moore Fixed the blank line

will-moore commented 5 years ago

This is also working on web-dev-merge now too. Good to merge.