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

Points in shape editor #555

Open will-moore opened 2 months ago

will-moore commented 2 months ago

NB: this is on top of Vite PR #477 - needs to be merged first.

As discussed at https://github.com/ome/omero-iviewer/pull/465#issuecomment-2066771147, need to support Points in OMERO.figure.

Points were already supported in Figure_To_Pdf.py.

To test:

pwalczysko commented 2 months ago

Tested as per header of PR. lgtm

will-moore commented 1 minute ago

Error seen when exporting a Figure with Points (due to usage of the def draw_ellipse() which expects the Shape to have rotation:

Traceback (most recent call last):
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 2547, in <module>
    run_script()
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 2533, in run_script
    file_annotation = export_figure(conn, script_params)
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 2486, in export_figure
    return fig_export.build_figure()
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 980, in build_figure
    self.add_panels_to_page(panels_json, image_ids, page)
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 1976, in add_panels_to_page
    self.add_rois(panel, page)  # This does nothing for TIFF export
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 1133, in add_rois
    ShapeToPdfExport(self.figure_canvas, panel, page, crop,
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 254, in __init__
    super(ShapeToPdfExport, self).__init__(panel)
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 188, in __init__
    getattr(self, 'draw_%s' % s['type'].lower(), lambda s: None)(s)
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 237, in draw_point
    self.draw_ellipse(s)
  File "/home/omero/omero/tmp/omero_omero/2785/processiav0i0nb.dir/./script", line 468, in draw_ellipse
    rotation = (shape['rotation'] + self.panel['rotation']) * -1
KeyError: 'rotation'