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

Dont scale line widths on zoom #281

Merged
merged 15 commits into from
May 16, 2018

Conversation

will-moore
Copy link
Member

@will-moore will-moore commented Apr 18, 2018

The problem we find with big images is that the current strategy of scaling stroke-widths of ROI shapes to the image pixels means that when you zoom out, the lines get thinner and are invisible for Big Images, unless you set a stroke width of 100!

Also, the scaling of stroke-widths with images is inconsistent with OMERO.iviewer, so thin lines drawn on a Big Image in iviewer are invisible in figure.

This PR includes ome/shape-editor#11 and means that when we zoom an image, the stroke widths stay the same. NB: since shape-editor is not released yet, I have copied the code over to test. When happy, can revert the TEMP commit and update version.
This means that all shapes on figure panels are shown on the figure at the same stroke-width, even when a panel is resized.
Export script is updated so that exported PDF / TIFF match what is in figure web UI.

When upgrading from older versions, we try to scale the line thickness to appear the same.

We now support line widths of 0.25 and 0.5 (previous minimum was 1).

@@ -86,6 +86,14 @@
"""


def scale_to_export_dpi(pixels):
"""
Origianl figure coordinates assume 72 dpi figure, but we want to
Copy link
Member

Choose a reason for hiding this comment

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

typo

@jburel
Copy link
Member

jburel commented Apr 18, 2018

commit after 19e3935 will need to be moved to the other PR
It is possible to split the original PR into few PRs
this is a huge one already and it is probably not finished

@will-moore
Copy link
Member Author

Sorry, not sure I understand - can discuss tomorrow...
I'm not sure if the Big Images PR can be split up, since testing any part of it requires other parts.

@jburel
Copy link
Member

jburel commented Apr 19, 2018

This PR also includes commit from #275

@will-moore will-moore force-pushed the dont_scale_line_widths_on_zoom branch from 96ec4e3 to e65982a Compare April 19, 2018 11:22
@will-moore
Copy link
Member Author

Cleaned up history to remove commit from #275.
Last commit handles updating from previous JSON version 2 -> 3 and we scale the strokeWidths of shapes to appear similar, but also ensure that minimum width is 1.
Screenshots show a figure created with v3.2.1 and then opened with last commit.
StrokeWidths on the original are the same for corresponding shapes in the 3 panels, but they appear different widths because of the pane sizes.
In the updated figure, strokeWidths are now different between the 3 panels, because they've been scaled differently in the upgrade. The appearance is similar, except for thin lines that are now no thinner than 1px on the page.

Before (v3.2.1)
screen shot 2018-04-19 at 11 32 45

After (current)
screen shot 2018-04-19 at 11 33 46

@will-moore will-moore closed this Apr 20, 2018
@will-moore will-moore reopened this Apr 30, 2018
@will-moore will-moore force-pushed the dont_scale_line_widths_on_zoom branch from e65982a to 472cd4d Compare April 30, 2018 22:21
@will-moore will-moore force-pushed the dont_scale_line_widths_on_zoom branch from ecc9ff3 to 1b5be45 Compare May 9, 2018 12:44
@will-moore will-moore force-pushed the dont_scale_line_widths_on_zoom branch from b174e75 to c264815 Compare May 9, 2018 13:29
@will-moore
Copy link
Member Author

Added support for line widths of 0.25 and 0.5 so we can more closely match existing thin lines when upgrading.

@pwalczysko
Copy link
Member

pwalczysko commented May 10, 2018

As discussed with @will-moore , all works fine here, except the gap in sizes causes some arrows which were fine in old versions to appear too thin. This is (hopefully) caused by the gap of the allowed sizes between 1 and 0.5. @will-moore will add the 0.75 size as well, which matches what Illustrator is doing and this will hopefully fix it. To be tested on https://nightshade.openmicroscopy.org/figure/file/366691

Another ToDo mentioned by @will-moore here is adding the upgrade logic to python, so that the export script can be run on old figures without opening these figures in the Figure UI first. As the opening in the Figure UI automatically upgrades the Figure, we need to take care for the situations where the old figures are directly fed into an export script.

@will-moore will-moore force-pushed the dont_scale_line_widths_on_zoom branch from 42c65e1 to b6a2150 Compare May 10, 2018 22:16
@will-moore
Copy link
Member Author

@pwalczysko I added support for 0.75 thick lines.
Also, you can now test exporting of version 2 JSON via running the Figure_To_PDF.py figure script from the webclient scripts menu, pasting in the JSON.

@pwalczysko
Copy link
Member

Unrelated issue with a dialog, created https://trello.com/c/UVmZ2YsJ/18-bug-typo-in-dialog

@pwalczysko
Copy link
Member

pwalczysko commented May 11, 2018

The 0.75 thickness is there and works nicely and I think it solves the problem

@pwalczysko
Copy link
Member

pwalczysko commented May 11, 2018

Bug?: I do not seem to be able to copy ROIs from a small image to a big one. This means, the figure UI is pretending that I succeeded, and all is fine. But I cannot find the ROIs I just pasted onto the big image on it. I do not think this is a question of color, the ROIs are suitably colored. Also, I understand that with this PR, the ROIs pasted onto the big image should appear as big as they are on a small one. http://web-dev-merge.openmicroscopy.org/figure/file/41051 username:outreach

edit: After I have exported this Figure, I find one of the pasted ROIs (red arrow, or rather its head) on the pdf. It is on the canvas though, not on the big image where I pasted it.

screen shot 2018-05-11 at 11 00 55

@pwalczysko
Copy link
Member

I am not sure if I get fully the workflow about running the script Figure_to_pdf from the webclient.

The json pasting is clear. But as I am pasting the json from nightshade figure, what do I give as the Webclient URL and Figure URL (the script demands these fields).
I gave the Webclient URL and Figure URL as the ones of the sister figure created on web-dev-merge.
I got

No handlers could be found for logger "figure_to_pdf"
/opt/hudson/workspace/OMERO-DEV-merge-deploy/src/dist/lib/python/omero/gateway/__init__.py:8563: DeprecationWarning: setActiveChannels() is deprecated in OMERO 5.4.0.Use set_active_channels
  "Use set_active_channels", DeprecationWarning)
/opt/hudson/workspace/OMERO-DEV-merge-deploy/src/dist/lib/python/omero/gateway/__init__.py:8828: DeprecationWarning: Deprecated in 5.4.0. Use setChannelInverted()
  DeprecationWarning)
/usr/lib64/python2.6/site-packages/reportlab/lib/utils.py:653: DeprecationWarning: tostring() is deprecated. Please call tobytes() instead.
  self._data = im.tostring()

@pwalczysko
Copy link
Member

When following the workflow #281 (comment), it is important to note that the figure pdf was created successfully using the webclient Figure_to_pdf script and looks identical to the pdf coming from export via Figure UI+Ui export as pdf.

@pwalczysko
Copy link
Member

Two (potential) problems still pending

@will-moore
Copy link
Member Author

The ROIs did paste OK, they were just invisible because they are too small.
If you zoom the big image in a fair bit, you can see them:

screen shot 2018-05-11 at 12 22 10

@will-moore
Copy link
Member Author

The errors you're seeing are just warnings printed to stderr which you don't normally see when running the script from webclient.
They should be investigated in another PR but shouldn't be an issue for this one.

@pwalczysko
Copy link
Member

@will-moore explained the case of lost Rois and we found them on the Figure finally. Did not realize that the ROIs will shrink on the big image because of the coordinates which are the same, and thus an arrow has infinetisimal length (although the thickness is kept at, say 2pt). This seems to be reasonable. This PR does solve the problem of shrinking of the ROIs out of view completely when these ROIs have been drawn on the same image zoomed out.

I created https://trello.com/c/ni0q2h5c/16-bug-figuretopdf for the problem #281 (comment)

Ready to merge FMPOV.

@jburel
Copy link
Member

jburel commented May 15, 2018

Recent changes have improved the drawing of arrow (problem reported during testing). It
looks now like an arrow and not a line
(not tested the pdf yet)

@will-moore will-moore force-pushed the dont_scale_line_widths_on_zoom branch from 336ac93 to 7028248 Compare May 15, 2018 11:56
@will-moore
Copy link
Member Author

Updated to use the shape-editor 4.0.0 from npm.
Ready for final testing of figures created from previous release, as discussed with @jburel

@jburel jburel added this to the 4.0.0 milestone May 16, 2018
@pwalczysko
Copy link
Member

Re-test:

All works fine. Ready to merge.

@jburel jburel merged commit d60bb7f into ome:master May 16, 2018
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.

3 participants