Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right vertical #519

Merged
merged 6 commits into from
Oct 31, 2023
Merged

Right vertical #519

merged 6 commits into from
Oct 31, 2023

Conversation

Rdornier
Copy link
Contributor

@Rdornier Rdornier commented Oct 2, 2023

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

@will-moore
Copy link
Member

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
Copy link
Contributor Author

Rdornier commented Oct 6, 2023

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
Copy link
Member

@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
Copy link
Contributor Author

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

@will-moore
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

Ok, now it works correctly !
Thanks !

temp_label = temp_label.rotate(90, expand=True)
y = y - (temp_label.size[1]/2)
elif align == "right-vertical":
temp_label = temp_label.rotate(-90, expand=True)
y = y - (temp_label.size[1]/2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need x = x - temp_label.size[0] here to shift the labels a bit to the left:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK !

@will-moore
Copy link
Member

Having got my TIFF export working (see #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

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jburel jburel merged commit 8f82fdc into ome:master Oct 31, 2023
@will-moore will-moore added this to the 6.1.0 milestone Nov 2, 2023
@Rdornier Rdornier deleted the right-vertical branch June 13, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants