We're Hiring!

How to get the list of all the TagAnnotationI objects?

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.

How to get the list of all the TagAnnotationI objects?

Postby Kouichi_C_Nakamura » Sun Jun 10, 2018 10:33 am

Hi,

Would someone be able to tell me how to retrieve the list of all the TagAnnotationI objects that are being used, including orphans?

In other words, what is the parent of Projects? User?

Best,
Kouichi
Kouichi_C_Nakamura
 
Posts: 165
Joined: Thu Oct 19, 2017 1:35 pm

Re: How to get the list of all the TagAnnotationI objects?

Postby jmoore » Mon Jun 11, 2018 7:20 am

Kouichi_C_Nakamura wrote:Hi,


Hi Kouichi,

Would someone be able to tell me how to retrieve the list of all the TagAnnotationI objects that are being used, including orphans?


getTagAnnotations should do what you want. Note: if you want to load tags from all groups at the same time pass group=-1.

In other words, what is the parent of Projects? User?


Hmmm.... I'm not sure I follow. This is the hierarchy as I understand it:

Code: Select all
ExperimenterGroup (group)
  Experimenter (user)
    Project
      Dataset
        Image


where a user can be in multiple groups, but projects, datasets, images, annotations, etc. must all be in a single group and belong to a single user. Further, datasets can be in multiple projects and images can be in multiple images. Finally, each of these objects can have annotations attached to them.

Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: How to get the list of all the TagAnnotationI objects?

Postby Kouichi_C_Nakamura » Mon Jun 11, 2018 11:28 am

Thank you for the response.

My UseCase here is that there are already a few images with various Tags, and that I want to pick up some of them and link them to other images.

In order to use getTagAnnotations for this purpose, I need to get the list of tagIDs.

Code: Select all
tags = getTagAnnotations(session,tagID)


How can I retrieve all the tag IDs that are visible in GUI's Tags pane?
Kouichi_C_Nakamura
 
Posts: 165
Joined: Thu Oct 19, 2017 1:35 pm

Re: How to get the list of all the TagAnnotationI objects?

Postby jmoore » Mon Jun 11, 2018 3:39 pm

Hi Kouichi,

so to clarify:

* you are looking at a dataset

* you select multiple images

* in the right-hand panel a number of tags are listed

That's what you would like to reproduce? If so, that should be the server-side loadAnnotations method. For example, see https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java#L1747.

Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: How to get the list of all the TagAnnotationI objects?

Postby Kouichi_C_Nakamura » Mon Jun 11, 2018 5:03 pm

Not quite. The list that appears in Tags pane on the left seems beyond Dataset or Project. Uh, maybe it's better to be called Tags tab rather than pane?

Nevertheless, your solution might just suffice for the purpose of avoiding duplicates. I'll have a go. Thank you.
Kouichi_C_Nakamura
 
Posts: 165
Joined: Thu Oct 19, 2017 1:35 pm

Re: How to get the list of all the TagAnnotationI objects?

Postby Kouichi_C_Nakamura » Mon Jun 11, 2018 9:01 pm

Sorry, I honestly can't work out how to prepare what sort of input arguments for loadAnnotations.

Code: Select all
service = session.getMetadataService
service.loadAnnotations('dataset',int64(1157),'tag',[],[])


loadAnnotations(string rootType, sys::LongList rootIds, StringSet annotationTypes, sys::LongList annotatorIds, sys::Parameters options)

rootType must be something like 'dataset' or 'Dateset', but where is it defined?
rootIds must be like int64(1157)
annotationTypes must be something like 'tag' or 'Tag', but again I can't find the defintion
annotatorIds can be [], I suppose
options ... I have no idea
Kouichi_C_Nakamura
 
Posts: 165
Joined: Thu Oct 19, 2017 1:35 pm

Re: How to get the list of all the TagAnnotationI objects?

Postby Dominik » Tue Jun 12, 2018 7:27 am

I think you need to use the omero.model.* class name for the root and annotation type, e.g. "omero.model.Dataset", for the different model classes see: https://downloads.openmicroscopy.org/om ... model.html

Regards,
Dominik
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am

Re: How to get the list of all the TagAnnotationI objects?

Postby Dominik » Tue Jun 12, 2018 7:55 am

I just tried it again with different arguments. You actually don't need the full class path, for example "Dataset" and "TagAnnotation" should be fine, too.

Regards,
Dominik
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am

Re: How to get the list of all the TagAnnotationI objects?

Postby Kouichi_C_Nakamura » Tue Jun 12, 2018 8:00 am

Thanks, but still something is wrong.

Code: Select all
service = session.getMetadataService

rootType = 'Dataset'
rootIds = int64(1157)
annnotationTypes = 'TagAnnotation'
annotatorIds = []
options = []

service.loadAnnotations(rootType,rootIds,annnotationTypes,annotatorIds,options)

No method 'loadAnnotations' with matching signature found for class 'omero.api.IMetadataPrxHelper'.

Parameters:
nodeType - The type of the nodes the annotations are linked to. Mustn't be null.
rootNodeIds - Ids of the objects of type rootNodeType. Mustn't be null.
annotationType - The types of annotation to retrieve. If null all annotations will be loaded. String of the type ome.model.annotations.*.
annotatorIds - Ids of the users for whom annotations should be retrieved. If null, all annotations returned.
options -

http://javadoc.scijava.org/OMERO/ome/ap ... arameters-
Kouichi_C_Nakamura
 
Posts: 165
Joined: Thu Oct 19, 2017 1:35 pm

Re: How to get the list of all the TagAnnotationI objects?

Postby Dominik » Tue Jun 12, 2018 8:11 am

The 'rootIds' and 'annnotationTypes' arguments have to be lists, a Long list and String list respectively.

Regards,
Dominik
User avatar
Dominik
Team Member
 
Posts: 149
Joined: Mon Feb 10, 2014 11:26 am

Next

Return to Developer Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron