Closed will-moore closed 7 years ago
Great stuff @will-moore. I like the drawing and rotation abilities.
That seems to all work as you described it, tried a rotated ellipse as well.
After changing stroke width and color, I wanted more and change the fill color. Maybe another follow-up idea...
To test the upgrade of Shapes json format from 5.2.x format to 5.3.x (ellipse.cx -> ellipse.x etc) we need to:
"version": 1
Then I will Open this PR again...
"version":2
{"type":"Ellipse","x":115.1,"y":119.1,"radiusX":82.8,"radiusY":41.4,"rotation":50.3 ...}
Created figure without this PR on eel.merge, http://web-dev-merge.openmicroscopy.org/figure/file/17602 (user-1)
Lots of ellipses and I have a copy of the JSON file as well : yes it is "version":1:
{"version":1,"panels":[{"labels":[],"height":94.18951612903223,"channels":....
After upgrade, we also need to test that figure export script works, as TIFF and PDF. (will need to manually upload the script).
@jburel
Let's discuss
After discussion with @jburel, TODOs:
Tried exporting, http://web-dev-merge.openmicroscopy.org/figure/file/17602
A figure file which was created before this PR was opened. https://github.com/ome/omero-figure/pull/190#issuecomment-281746124
And got the following exceptions when I tried to export as pdf,
No handlers could be found for logger "figure_to_pdf" /usr/lib64/python2.6/site-packages/reportlab/lib/utils.py:653: DeprecationWarning: tostring() is deprecated. Please call tobytes() instead. self._data = im.tostring() Traceback (most recent call last): File "./script", line 1665, in
run_script() File "./script", line 1651, in run_script file_annotation = export_figure(conn, script_params) File "./script", line 1609, in export_figure return fig_export.build_figure() File "./script", line 690, in build_figure self.add_panels_to_page(panels_json, image_ids, page) File "./script", line 1311, in add_panels_to_page self.add_rois(panel, page) # This does nothing for TIFF export File "./script", line 823, in add_rois self.page_height) File "./script", line 130, in init self.draw_ellipse(shape) File "./script", line 319, in draw_ellipse c = self.panel_to_page_coords(shape['x'], shape['y']) KeyError: 'x'
And for conversion to tiff,
No handlers could be found for logger "figure_to_pdf" Traceback (most recent call last): File "./script", line 1665, in
run_script() File "./script", line 1651, in run_script file_annotation = export_figure(conn, script_params) File "./script", line 1609, in export_figure return fig_export.build_figure() File "./script", line 690, in build_figure self.add_panels_to_page(panels_json, image_ids, page) File "./script", line 1307, in add_panels_to_page image, pil_img = self.draw_panel(panel, page, i) File "./script", line 1140, in draw_panel self.paste_image(pil_img, img_name, panel, page, dpi) File "./script", line 1503, in paste_image ShapeToPilExport(pil_img, panel, crop) File "./script", line 381, in init self.draw_ellipse(shape) File "./script", line 518, in draw_ellipse ctr = self.get_panel_coords(shape['x'], shape['y']) KeyError: 'x'
Same errors, looks like an issue with getting the panel coordinates! Is this related to/caused by my width and height PR (we handled the page-wise x,y coordinate management in that PR)? https://github.com/ome/omero-figure/pull/169
@bramalingam I'm trying to understand the bug you found. The Ellipses that are giving you errors on the figure seem to come from OMERO (ID matches an Ellipse on that image in OMERO). Can you remember how you created that figure, since if the figure was created without this PR merged, you shouldn't have been able to load ROIs from OMERO. Maybe that came from a previously created figure?
{"rotation":60.65125478487214,"strokeWidth":1,"type":"Ellipse","strokeColor":"#c3c4c4","id":1751}
I just tried this:
Does this sound feasible?
To try reproduce the upgrade issue above, closing this PR so we can create figures without it merged.
Recent changes to test:
Checked the most recent changes and they all work.
@bramalingam Can you try testing the upgrade of shapes again? @jburel Do you want to check that workflow is behaving as we discussed above?
Rechecked the following scenario,
1) Created Figure with ROI's without this PR. ( json should contain "version 1") 2) fetched this branch and opened the same Figure, and exported as pdf.
Can no longer see the exception seen in : https://github.com/ome/omero-figure/pull/190#issuecomment-284007902
and can see version 2 in the json as well.
Looking at http://web-dev-merge.openmicroscopy.org/figure/file/17602/
RFE: A "undo" the copy paste for example will be nice (not in this PR)
Open the "ROI dialog", the tooltip of the Load ROIs
button always indicates the number of rois of the first image I opened
I will remove the number from the tooltip.
@jburel - I can't reproduce the tooltip bug https://github.com/ome/omero-figure/pull/190#issuecomment-289783627
As discussed with @bramalingam, when you "OK" the ROI dialog, the Z and T position of the dialog get saved to your figure. If you don't want to change the Z/T, then you can 'revert' to the original Z/T using new buttons:
The above functionality works as expected.
2 separate points to consider: 1) Display of the ROI/Shape ids from OMERO, and 2) Size/width of the rows/columns in the ROI table.
Also, an edge case workflow where an ellipse ROI/shape has its centre outside the bounds of the viewport, throws a not so informative dialog box. Maybe update the text in the dialog box or handle ellipse's better when there are near the edges of the image? (Can be ignored as well, because in a user workflow I wouldn't expect the ROI's around the edges to be useful in many ways)
Added IDs to the ROI/Shapes table to look more like iViewer cc @waxenegger
Latest commits work as as intended. Shape Id is showing and tooltip gives me coordinates.
similar to iviewer: I am not sure about the shape/roi ID. Especially with the high number
Few comments:
@will-moore I cannot reproduce the roi count issue, I don't think it was ever a problem
Previously opened as https://github.com/ome/omero-figure/pull/165 Ported to new code layout by squashing commits etc.
This allows loading of ROIs from OMERO to add to figure panels as new Shapes.
To test:
Follow up ideas: