Standalone python script#669
Conversation
567f85c to
0affd4b
Compare
|
|
@pwalczysko This PR wasn't included in merge-ci today, but you can still test the |
|
wfm, but it feels strange to test it only on the one single json which is mentioned in teh header of the PR. Would this work also on a Figure which was created in OMERO with all the images as Zarrs ? |
Answer is: Yes, this is possible. Created a json out of the (purely zarr-containing) figure https://merge-ci.openmicroscopy.org/web/figure/file/8175. Then run the cmd Basically, the pdf once created is not overwritten if another json is fed into the cmd |
pwalczysko
left a comment
There was a problem hiding this comment.
Please address the comment ^^^ thank you
|
@pwalczysko Done: |
|
Tried to test what happens if I use LUTs in a figure. Exported the Error Imho it is fine not to support LUTs (simple colorbar was working fine, I think the error is rather about the LUTs). |
|
@pwalczysko OK, so I've ignored LUTs for now, and added a |
pwalczysko
left a comment
There was a problem hiding this comment.
figure_export colorbar.json testcolobar-aha.pdf
input: colorbar.json
output: testcolobar-aha.pdf
render_zarr_to_pil: URL https://uk1s3.embassy.ebi.ac.uk/idr/share/ome2024-ngff-challenge/idr0036/20633.ome.zarr/I/6/0
Traceback (most recent call last):
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/bin/figure_export", line 6, in <module>
sys.exit(figure_export())
^^^^^^^^^^^^^^^
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/lib/python3.12/site-packages/omero_figure/cli.py", line 57, in figure_export
export_figure(None, script_args)
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/lib/python3.12/site-packages/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py", line 3431, in export_figure
return fig_export.build_figure()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/lib/python3.12/site-packages/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py", line 1257, in build_figure
self.add_panels_to_page(panels_json, page)
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/lib/python3.12/site-packages/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py", line 2763, in add_panels_to_page
self.draw_colorbar(panel, page)
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/lib/python3.12/site-packages/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py", line 2002, in draw_colorbar
color_ramp = self.get_color_ramp(channel)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pwalczysko/opt/anaconda3/envs/figure_export/lib/python3.12/site-packages/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py", line 1935, in get_color_ramp
script_service = self.conn.getScriptService()
^^^^^^^^^^^^^^^^^^^^^^^^^^
The error above is different than previously. I have reinstalled omero-figure in my env. The non-colorbar figure is working fine.
Co-authored-by: pwalczysko <p.walczysko@dundee.ac.uk>
|
@pwalczysko Thanks for that - LUTs now also grey in colorbars, removed extra line, and also fixed handling of "inactive" channels for Zarr. |
|
Tested again, with LUTs, colorbar and fresh ROIs. lgtm, thanks |
There was a problem hiding this comment.
Just a second. I have realized you are overwriting the existing script in this PR ?
I have uploaded the Figure_to_pdf.py script from this PR to merge-ci.
Then I have exported the figure (the old way) and see that there is a discrepancy between the generated pdf and the Figure https://merge-ci.openmicroscopy.org/web/figure/file/8175/
Possibly this is expected, but I would like us to have a look, thanks.
|
@pwalczysko The issue you're seeing there is the lack of support for rendering LUT channels of OME-Zarr images, so it's greyscale in the image. |
|
Tested couple of more figures on merge-ci, mostly non-zarr, but also zarr, with ROIs and LuTs as well as switched-off channels. |
As part of the work to support figure usage and PDF/TIFF generation with OME-Zarr data (without using OMERO),
this PR focusses on the Figure_To_Pdf.py (see #619 for front-end changes).
We want to be able to use the same PDF/TIFF generation code both in OMERO and as a stand-alone script (in a python environment that doesn't have
omero-pyinstalled, but has zarr, dask etc instead).Basic idea is that you go to a stand-alone OMERO.figure app (from #619) e.g. https://will-moore.github.io/omero-figure/?file=https://gist.githubusercontent.com/will-moore/75a7f0de5be0f7b4202d5f0229cadcc9/raw/8d9681c70354189420c1c0adfe1f442dd1caac3e/ngff_images_figure.json and
File > Saveto download thefigure.jsonfile.NB: LUTs not yet supported for Zarrs
Then, you run below (also added this to README):
TODO: