Page 1 of 1

WebGateway usertags

PostPosted: Mon Mar 31, 2014 1:45 pm
by toniher
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!

Re: WebGateway usertags

PostPosted: Mon Mar 31, 2014 2:29 pm
by wmoore
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.

Re: WebGateway usertags

PostPosted: Mon Mar 31, 2014 3:25 pm
by toniher
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!

Re: WebGateway usertags

PostPosted: Tue Apr 01, 2014 9:44 am
by atarkowska
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

Re: WebGateway usertags

PostPosted: Mon May 05, 2014 3:44 pm
by wmoore
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.