Page 1 of 2

How to get the list of all the TagAnnotationI objects?

PostPosted: Sun Jun 10, 2018 10:33 am
by Kouichi_C_Nakamura
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

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

PostPosted: Mon Jun 11, 2018 7:20 am
by jmoore
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

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

PostPosted: Mon Jun 11, 2018 11:28 am
by Kouichi_C_Nakamura
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?

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

PostPosted: Mon Jun 11, 2018 3:39 pm
by jmoore
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

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

PostPosted: Mon Jun 11, 2018 5:03 pm
by Kouichi_C_Nakamura
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.

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

PostPosted: Mon Jun 11, 2018 9:01 pm
by Kouichi_C_Nakamura
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

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

PostPosted: Tue Jun 12, 2018 7:27 am
by Dominik
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

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

PostPosted: Tue Jun 12, 2018 7:55 am
by Dominik
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

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

PostPosted: Tue Jun 12, 2018 8:00 am
by Kouichi_C_Nakamura
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-

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

PostPosted: Tue Jun 12, 2018 8:11 am
by Dominik
The 'rootIds' and 'annnotationTypes' arguments have to be lists, a Long list and String list respectively.

Regards,
Dominik