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

Right vertical #519

Closed Rdornier closed 8 months ago

Rdornier commented 9 months ago

Add the option to put labels to the right-vertical of the image

will-moore commented 9 months ago

This looks like it's working well in the web app. I'm afraid it will also need a corresponding change in the export script: https://github.com/ome/omero-figure/blob/master/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py

Rdornier commented 9 months ago

Actually, I didn't know that Figure_to_pdf also need to be modified... I try to add the right vertical position but it seems to not work properly. Right vertical labels are not displayed. Do you know if I only need to modify this file or if there is anther one linked to Figure_to_Pdf.py that I also need to change ?

will-moore commented 8 months ago

@Rdornier After spending a while to remember how labels are laid out in reportlab, I finally found that this is what you need:

$ git diff
diff --git a/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py b/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
index 1c24f14..aa0adfe 100644
--- a/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
+++ b/omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
@@ -2044,11 +2044,11 @@ class FigureExport(object):
             # Switch axes
             c.rotate(-90)
             px = x
-            x = y
-            y = -px
+            x = -y
+            y = px
             # Align center
             alignment = TA_CENTER
-            x = x + (para_width/2)
+            x = x - (para_width/2)

         # set fully opaque background color to avoid transparent text
         c.setFillColorRGB(0, 0, 0, 1)
Rdornier commented 8 months ago

Thanks @will-moore ; However, the labels are still not displayed yet

will-moore commented 8 months ago

Are you sure you've got the changes applied (and updated the script on the server)? This is certainly working for me - even tested with multi-page figure (PDF export)

PDF on the right:

Screenshot 2023-10-10 at 10 24 12

However, I just tried TIFF export and got an error, so I can't test that just now...

Rdornier commented 8 months ago

Ok, happy to see that it works well on your side ! I'm running the tests on docker. I just run grunt build in docker terminal and until now, it works pretty well. Is that possible the script also needs to be updated on the server side ? (the one mounted on OMEROHOST $ docker run -ti -e OMEROHOST=YOUR_HOST -p 4080:4080 figure-devel)

will-moore commented 8 months ago

Yes, the script will need to be uploaded to the server. If it's a remote server, you'll need to be an Admin on the server, then you can use the webclient to upload or replace the script. You'll see the "Upload Script" option in the scripts menu. You'll need to choose the /omero/figure_scripts/ folder so the script replaces the existing one.

Rdornier commented 8 months ago

Ok, now it works correctly ! Thanks !

will-moore commented 8 months ago

Having got my TIFF export working (see https://github.com/ome/omero-figure/pull/523), I found that I needed to shift them left a bit (see comment above) to get the TIFF to match the app:

Screenshot 2023-10-17 at 22 01 26