[ome-devel] get annotations java code
Thomas Boudier
boudier.t at wehi.edu.au
Fri Jun 1 01:00:59 BST 2018
Dear Omero devs,
I would like to access key value pairs assocaited to an image but created by other users. It seems, thanks to the code provided on the omero website, to extract all annotations from me, but I do not know how to get only annotatins assocaited to a specific image.
here the code I wrote with "image" being an imageData object.
long userId = gateway.getLoggedInUser().getId();
List<String> nsToInclude = new ArrayList<>();
//nsToInclude.add(MapAnnotationData.NS_CLIENT_CREATED);
List<String> nsToExclude = new ArrayList<>();
ParametersI param = new ParametersI();
//param.exp(omero.rtypes.rlong(userId)); // user
param.exp(omero.rtypes.rlong(image.getId())); // image ??
IMetadataPrx proxy = gateway.getMetadataService(ctx);
try {
List<Annotation> annotations = proxy.loadSpecifiedAnnotations(MapAnnotation.class.getName(), nsToInclude, nsToExclude, param);
IJ.log(annotations.size() + " annotations found");
for (Annotation annotation : annotations) {
IJ.log(" "+annotation.getClass()+" "+annotation.getId());
MapAnnotation mapAnnotation = (MapAnnotation) annotation;
List<NamedValue> list = mapAnnotation.getMapValue();
for (NamedValue namedValue : list)
IJ.log(namedValue.name + " " + namedValue.value);
}
} catch (ServerError serverError) {
IJ.log("Pb reading annotation " + serverError.message);
serverError.printStackTrace();
}
Thanks for any help.
best
Thomas
--
/***************************************************************/
Thomas Boudier, Senior Research Officer,
BioImage Analyst, Dynamic Imaging Centre,
Walter and Eliza Hall Institute (WEHI), Australia.
/**************************************************************/
_______________________________________________
The information in this email is confidential and intended solely for the addressee.
You must not disclose, forward, print or use it without the permission of the sender.
The Walter and Eliza Hall Institute acknowledges the Wurundjeri people of the Kulin
Nation as the traditional owners of the land where our campuses are located and
the continuing connection to country and community.
_______________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20180601/1d068c47/attachment.html>
More information about the ome-devel
mailing list