[ome-users] FW: List all tags

John Webber (NBI) John.Webber at nbi.ac.uk
Thu Mar 13 14:47:56 GMT 2014


All,

I have solved the issue - after a lot of attempts, research and a little swearing!

I have done the following to search for a given "tag":

obs = Blitz.getObjects("TagAnnotation", attributes={'textValue':tag})
obs = list(obs)

If this returns a blank list, I create the tag and link it to the Image as required.  If this returns any items, then I do the following to link the existing tag to the image:

upServ = conn.getUpdateService()
link = ImageAnnotationLinkI()
link.setParent(ImageI(im_id, False))
link.setChild(obs[0]._obj)
ret = upServ.saveAndReturnObject(link)

Thanks
John


From: ome-users-bounces at lists.openmicroscopy.org.uk [mailto:ome-users-bounces at lists.openmicroscopy.org.uk] On Behalf Of John Webber (NBI)
Sent: 13 March 2014 10:47
To: ome-users at lists.openmicroscopy.org.uk
Subject: [ome-users] List all tags

All,

Please can you advice how I can list all of the tags owned by a given Omero user account, using the Omero APIs?

I am able to list all tags for a project, dataset or an image, using code like the following:

    img = Blitz.getObject("Image", "479")
    for ann in img.listAnnotations():
        if ann.OMERO_TYPE == tag_type:
<do something>

Please can anyone assist in listing the tags for a specific user?

Thanks
John



--------------------------------------------------------------------------------------------------------------------------------------------
John Webber
Computing and Information Services
NBI Partnership Ltd
Norwich Research park
Colney Lane
Norwich
NR4 7UH

E-Mail: john.webber at nbi.ac.uk<mailto:john.webber at nbi.ac.uk>
Web:     http://www.nbi.ac.uk<http://www.nbi.ac.uk/>
Tel:         +44(0)1603 450 818

Helpdesk (Tel):  1234      HPC Support (Web):       http://hpc.nbi.ac.uk<http://hpc.nbi.ac.uk/>  (NBI  internal)
                                                HPC Support (Tel):           2003  (NBI internal)

The NBI Partnership Ltd provides non-scientific services to the Institute of Food Research, the John Innes Centre, The Genome Analysis Centre and The Sainsbury Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20140313/624297f5/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT00001.txt
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20140313/624297f5/attachment.txt>


More information about the ome-users mailing list