TheJacksonLaboratory / ezomero

A module with convenience functions for writing Python code that interacts with OMERO.
GNU General Public License v2.0
39 stars 13 forks source link

[FEATURE] Getting Tag annotations #30

Closed romainGuiet closed 3 years ago

romainGuiet commented 3 years ago

Is your feature request related to a problem? Please describe. From ezomero doc. and from the omero annotations doc. I understand we can retrieve map_annotations (A list of key-value pairs), and file_annotation (like pdf from omer.ofigure). Do you plan to get other annotations, like tags ?

mellertd commented 3 years ago

This is definitely doable, the question is what should a returned tag look like?

I think I would have a function that is something like get_tag_ids for getting the ids of tags for an OMERO object, similar to how we deal with other annotations. From there you can of course use conn.getObjects to get the wrapped TagAnnotation objects, but I assume you want something a little more straightforward? Like returning just the tag name?

So something like this:

>>> tag_ids = ezomero.get_tag_ids(conn, 'Image', im_id)
>>> tags = [ezomero.get_tag(conn, tag_id) for tag_id in tag_ids]
>>> print(tags)
['tag1', 'tag2', 'tag3']

?

romainGuiet commented 3 years ago

Like returning just the tag name?

Exactly! The solution you proposed looks awesome!

Cheer

erickmartins commented 3 years ago

PR #32 implements this - if there is a need for posting/linking tags as well, a new issue is always welcome :)