We're Hiring!

WebGateway usertags

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

WebGateway usertags

Postby toniher » Mon Mar 31, 2014 1:45 pm

Hello,

I've been checking:
https://www.openmicroscopy.org/site/sup ... teway.html
and I've found no way to search (or retrieve) usertag information using REST API (JSON)

Is that something possible to be done?

Thanks in advance!
toniher
 
Posts: 2
Joined: Mon Mar 31, 2014 1:09 pm

Re: WebGateway usertags

Postby wmoore » Mon Mar 31, 2014 2:29 pm

It's certainly possible to add to the webgateway json API.

What are the kinds of queries you'd need?
If it's a couple of core methods that would be generally useful to others, then we can consider adding them to the webgateway itself.
But if you plan to make extensive use of this then you may want to extend webgateway yourself (or add your own app - see https://www.openmicroscopy.org/site/sup ... teApp.html).

The closest existing method is in webclient:
Code: Select all
/webclient/load_tags/

This returns html currently, listing the current users tags. We could add json support to this, but in general the webclient urls are not considered to be a stable & open API.

Regards,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: WebGateway usertags

Postby toniher » Mon Mar 31, 2014 3:25 pm

Hello,

the query I was thinking is retrieving images which has an associated usertag.
I noticed that usertag info is not available either when querying with imgData.

Thanks for the quick reply!
toniher
 
Posts: 2
Joined: Mon Mar 31, 2014 1:09 pm

Re: WebGateway usertags

Postby atarkowska » Tue Apr 01, 2014 9:44 am

Hello,

The simplest way is to write your own annotationData_json that server what is needed

Code: Select all
def parseTags(annotations)
    tag_annotations = list()
    for ann in annotations:
        if isinstance(ann._obj, TagAnnotationI):
            // other annotation checks goes here, like NameSpace, etc.
            tag_annotations.append(ann)
    return tag_annotations.sort(key=lambda x: x.textValue)
   
def annotationsData_json (request, conn=None, _internal=False, **kwargs):
   
    iid = kwargs['iid']
    key = kwargs.get('key', None)
    image = conn.getObject("Image", iid)
    tagAnnotations = parseTags(image.listAnnotations())
   
    // serialization



Let me know if that works

Ola
atarkowska
 
Posts: 327
Joined: Mon May 18, 2009 12:44 pm

Re: WebGateway usertags

Postby wmoore » Mon May 05, 2014 3:44 pm

Hi,

Do you simply want to retrieve projects/datasets/images tagged with a particular tag string? E.g. to find Images tagged with 'MyTag':

webgateway/tagged/images/MyTag/ returns [ {'id:123, 'name': 'image1.tiff'}, {'id':789, 'cell.dv'} ]

bearing in mind that there may be more than one tag called 'MyTag'?

Or you could look by TagId
webgateway/tagged/images/468/

but then you'd also need a way of finding tags with a specified name.

If you want everything (projects, datasets, images etc) tagged with a specified tag, you might want

webgateway/tagged/MyTag/ return [ {'id:123, 'type': 'image', 'name': 'image1.tiff'}, {'id':789, 'type': 'dataset', 'name': 'test'} ]

Let me know what you're thinking.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests