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

Paste crop region to Rectangle strokeWidth "2" #427

Closed will-moore closed 3 years ago

will-moore commented 3 years ago

As reported by @pwalczysko (below), and previously by @emilroz, script export fails when strokeWidth is a string. @emilroz proposed a fix to the script (see #409 and #426) but it would also be good to fix this "at source". It seems that if you Copy a crop region and Paste as a Rectangle on a new image, this is given strokeWidth:"2", which should be a simple fix. Would be good to get this in the upcoming release...

Traceback (most recent call last):
  File "./script", line 2361, in <module>
    run_script()
  File "./script", line 2347, in run_script
    file_annotation = export_figure(conn, script_params)
  File "./script", line 2303, in export_figure
    return fig_export.build_figure()
  File "./script", line 977, in build_figure
    self.add_panels_to_page(panels_json, image_ids, page)
  File "./script", line 1803, in add_panels_to_page
    image, pil_img = self.draw_panel(panel, page, i)
  File "./script", line 1634, in draw_panel
    self.paste_image(pil_img, img_name, panel, page, dpi)
  File "./script", line 2055, in paste_image
    ShapeToPilExport(pil_img, panel, crop)
  File "./script", line 522, in __init__
    super(ShapeToPilExport, self).__init__(panel)
  File "./script", line 187, in __init__
    getattr(self, 'draw_%s' % s['type'].lower(), lambda s: None)(s)
  File "./script", line 641, in draw_rectangle
    stroke_width = scale_to_export_dpi(shape.get('strokeWidth', 2))
  File "./script", line 111, in scale_to_export_dpi
    return pixels * 300//72
TypeError: unsupported operand type(s) for //: 'str' and 'int'
will-moore commented 3 years ago

This was fixed in #426