Hello! I am a fairly new user of OMERO. I am trying to copy and paste ROIs from a picture A to another picture B. This works and it is straightforward. However, the pasted ROIs conserve the alignment to the original picture A, and usually picture B is rotated, so I cannot overlay a ROI from A with picture B. Any ideas? I am also a basic python user, so I could also try to implement a solution through python with a bit of help. Thanks a lot in advance!!! All the best, Carolina
Are you looking for a way to manually rotate the Roi after pasting it to image B? Or do you think about an automated solution?
Unfortunately the OMERO clients don’t support rotation very well, although the OMERO server does allow you to save a 2D affine transform matrix on a Shape.
I’m assuming you’re using the web-based OMERO.iviewer to copy & paste ROIs?
The Desktop OMERO.insight app does allow you to rotate Ellipses only and saves that as a 2D transform:
This transform is handled correctly by the old webclient viewer (use the right-click menu to: Open with… > Image viewer) but you can’t edit ROIs in that viewer. The iviewer doesn’t handle the transform matrix.
What kind of shapes are you copy / pasting? Rectangles? Polygons?
If you know the origin of rotation (e.g. the mid-point of the shape bounding box) you could write some Python code to simply rotate each point of a Polygon/Polyline (or even convert a Rectangle to a Polygon) and save the rotated coordinates.
Or you could manually add a Point to each image for your Python code to use as a centre of rotation for your Polygon (it could also remove this Point once the rotation is done).
If this sounds like it might work, we can certainly help with some Python example code.
The first step would be to install the
omero-py package and it’s dependencies (preferably via conda) - see https://docs.openmicroscopy.org/omero/5.6.0/developers/Python.html
Hi phaub, I was wondering if the functionality existed for manual rotation. A colleague implemented a solution for image registration and I think I will have to go with that. Thanks for your reply!
Hi will-moore! As I mentioned in my previous comment, a colleague implemented a solution based in image registration in python. I will see how that works and keep you guys posted! Thanks so much for the replies!
I’m not familiar with the interface between OMERO and ImageJ.
If you can switch from OMERO to ImageJ and if you can access and modify your ‘OMERO Rois’ in ImageJ and transfer the rotated Rois back then you can perform manual rotation in IJ.
"You can interactively rotate selections using the “Selection Rotator” tool, which is included with ImageJ 1.50d. To add this tool to the toolbar, select it from the toolbar’s “>>” menu."
You can use the ImageJ-OMERO plugin to connect the two.
This link below  shows how this can be achieved using either the User Interface or a scripting approach.
You could load the ROIs stored in OMERO and manipulate them in Fiji for example and save the rois back. Note that new ROIs will be created, we do not keep track of changes when done outside OMERO.
Another option could be to write a Python script to manipulate the ROIs.