[ome-users] FW: List all tags
Will Moore
will at lifesci.dundee.ac.uk
Thu Mar 13 23:03:17 GMT 2014
Hi John,
To answer your original question on how to list all tags owned by a given user...
>>> params = omero.sys.ParametersI()
>>> eid = conn.getUserId() # current user
>>> params.theFilter = omero.sys.Filter()
>>> params.theFilter.ownerId = rlong(eid)
>>> tags = conn.getObjects("TagAnnotation", params=params)
Hope that helps,
Will.
On 13 Mar 2014, at 14:47, John Webber (NBI) wrote:
> 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
> Web: http://www.nbi.ac.uk
> Tel: +44(0)1603 450 818
>
> Helpdesk (Tel): 1234 HPC Support (Web): 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
>
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20140313/41d3e755/attachment.html>
More information about the ome-users
mailing list