GReD-Clermont / omero_batch-plugin

GNU General Public License v2.0
5 stars 0 forks source link

Set Name of ROIs in OMERO #14

Open JensWendt opened 1 year ago

JensWendt commented 1 year ago

Hello,

I stumbled upon your great plugin and try to incorporate it into a bigger workflow. A quick overview:

So far I made good progress but stumbled upon the fact, that ROIs generated by your plugin do not have a name or description in OMERO, although they have a comment in the iViewer which shows the correct name they had in Cellprofiler/Fiji. Without ROI name it is unfortunately not possible to associate the ROIs with their respective measurements with populate metadata. Could you maybe implement a roi.setName() here? https://github.com/GReD-Clermont/omero_batch-plugin/blob/64f58a70f03847bea1fc9709a7d70fa9364c2203/src/main/java/fr/igred/ij/macro/OMEROBatchRunner.java#L797 The goal is to have what is a comment now as the ROI.name. Unfortunately I lack the Java knowledge and cannot make a pull request on my own.

ppouchin commented 1 year ago

Hi @JensWendt!

So far I made good progress but stumbled upon the fact, that ROIs generated by your plugin do not have a name or description in OMERO, although they have a comment in the iViewer which shows the correct name they had in Cellprofiler/Fiji. Without ROI name it is unfortunately not possible to associate the ROIs with their respective measurements with populate metadata. Could you maybe implement a roi.setName() here?

I'm just curious: do you usually see ROI names in OMERO? Because I was under the impression only comments on shapes were visible. As mentioned in this thread, the Java Gateway does not provide a setName method for ROIData, and this name is not properly displayed by the viewer for now apparently.

Nevertheless, I'll see if I can incorporate what was mentioned in the thread I linked into the underlying library (Simple OMERO Client), which I still haven't done (despite mentioning it months ago). My workload has slowed the tools development quite a bit the past few months, but I'm still trying to improve them.

JensWendt commented 1 year ago

Hello @ppouchin ,

I do not see the ROI names in OMERO. I am also not quite aware of the interplay between ROIData and "actual" ROI. I was under the impression you have to create an omero-model-ROI which you then save to OMERO. at least this object has a setName() Alternatively if one can access the shape comment via python I could try and write a script which gets all ROIs of an image, gets the comments of the corresponding (single) shape and sets it as a name for its ROI

ppouchin commented 1 year ago

Hi,

What should be set as the ROI name?

Edit: Ok, I'm changing how things work a bit. Currently, the "ROI" property is a local index. I'll change that to the ROI name.

JensWendt commented 1 year ago

Hi, For my process I would need the names of the OMERO-ROIs to be the same as the names of the ROIs in Fiji. The reason being, I use a Fiji macro in your plugin that goes through mask/label images and creates ROIs out of the different objects and names them according to the grey-value (which was the object number in CellProfiler, where the label image was created). I then need the ROIs to have the same name in OMERO as they had in Fiji (and previously CellProfiler) because I want to put an OMERO.table on their Dataset with the individual ROI-measurements coming out of CellProfiler. The mapping will only work if the names are congruent.

Somehow you can read those ROI names in Fiji it seems, as now they are put as Comment of the shapes.

Generally speaking I think people would expect the ROI name to be consistent between OMERO and Fiji.

PS: Just out of curiosity, are you strictly attaching one Shape to one ROI, or is there a possibility for multiple Shapes (previously Fiji-ROIs) for one OMERO-ROI?

ppouchin commented 1 year ago

Currently, I import Fiji ROIs as shapes in OMERO. However, to group multiple "shapes" in one OMERO ROI, a property ("ROI") must be set and share the same value for shapes that belong to the same 4D ROI.

For example, if you create 4 squares in different planes through a Fiji macro, you can put them in one OMERO ROI if you use Roi.setProperty("ROI", "1"); on each one: the batch plugin will check which ROIs share the same value and group them.

For now, it expected this value to be numeric (corresponding to a local index), but what I'll do is use this as the ROI name.

ppouchin commented 1 year ago

Updating"simple-omero-client-5.9.2.jar" to the 5.9.3 version should allow you to set the ROI name from Fiji by putting in your macro Roi.setProperty("ROI", roiName);. You can also define the shape name (in a given slice) by setting the Roi name in Fiji: Roi.setName(shapeName);.

JensWendt commented 1 year ago

I will try it out soon.