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

Apply transform to rectangles when exporting via PIL #315

Closed knabar closed 4 years ago

knabar commented 5 years ago

https://github.com/ome/omero-figure/pull/306 introduced a bug that causes transformations not to be applied to rectangles when exporting via PIL. It probably went undiscovered since rectangles usually don't have a transformation (rotation) applied.

chris-allan commented 5 years ago

Weird Travis flake8 issues:

flake8.plugins.manager    MainProcess    208 ERROR    'module' object has no attribute 'break_after_binary_operator'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/flake8/plugins/manager.py", line 182, in load_plugin
    self._load(verify_requirements)
  File "/usr/lib/python2.7/site-packages/flake8/plugins/manager.py", line 154, in _load
    self._plugin = resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2356, in resolve
    raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'break_after_binary_operator'
flake8.plugins.manager    MainProcess    209 CRITICAL Flake8 failed to load plugin "pycodestyle.break_after_binary_operator" due to 'module' object has no attribute 'break_after_binary_operator'.
Traceback (most recent call last):
  File "/usr/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/usr/lib/python2.7/site-packages/flake8/main/application.py", line 412, in run
    self._run(argv)
  File "/usr/lib/python2.7/site-packages/flake8/main/application.py", line 399, in _run
    self.initialize(argv)
  File "/usr/lib/python2.7/site-packages/flake8/main/application.py", line 381, in initialize
    self.find_plugins()
  File "/usr/lib/python2.7/site-packages/flake8/main/application.py", line 197, in find_plugins
    self.check_plugins.load_plugins()
  File "/usr/lib/python2.7/site-packages/flake8/plugins/manager.py", line 434, in load_plugins
    plugins = list(self.manager.map(load_plugin))
  File "/usr/lib/python2.7/site-packages/flake8/plugins/manager.py", line 319, in map
    yield func(self.plugins[name], *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/flake8/plugins/manager.py", line 432, in load_plugin
    return plugin.load_plugin()
  File "/usr/lib/python2.7/site-packages/flake8/plugins/manager.py", line 189, in load_plugin
    raise failed_to_load
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "p

You've seen this before and know what we need to do right @sbesson?

sbesson commented 5 years ago

That's correct. The issue is unrelated to this PR and my initial investigation and options to get back to a green state are described in https://github.com/openmicroscopy/omero-test-infra/issues/26. I will not have time to invest into helping with the fix over the next few days although happy to discuss if needed.

jburel commented 5 years ago

omero-test-infra has been fixed and tagged

I re-ran travis and there is a flake8 error:

./omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py:639:17: F812 list comprehension redefines 'point' from line 621

jburel commented 5 years ago

@will-moore will you be able to test this PR?

will-moore commented 5 years ago

I manually added a random transform "transform": {"A00":0, "A01":0.5, "A02": 0, "A10":0.5, "A11":0, "A12":0} to the JSON of a Rectangle and it was applied in the export to PIL (although I don't know how users are normally expected to choose a transform or if the transform behaved as expected).

mtbc commented 5 years ago

Perhaps the matrix equation in [blog] Affine Transformations of ROI Shapes helps clarify expectations.

will-moore commented 5 years ago

@mtbc Thanks, but not really. I'm not familiar enough with matrix transforms to know what to expect without having to go and find some tool to help me.