I already have a MapAnnotation which is linked to an image or multiple images on OMERO. While keeping the ID of MapAnnotation unchanged, how can I modify the content of MapAnnotations?
Because the link is already there, I thought something like below might work, but it says:
Java exception occurred:
Ice.ObjectNotExistException
- Code: Select all
client = loadOmero('xxxxxxxxxx', 4064);
session = client.createSession(username, password);
imageID = 74;
ma2 = getObjectAnnotations(session, 'map', 'image', imageID);
% modify the content of s
s = string(mapAnnotationToCellstr(ma2));
s_ = ["Experimenter","Mr Default Contrast";s];
keys = cellstr(s_(:,1));
values = cellstr(s_(:,2));
nv = java.util.ArrayList();
for i = 1 : numel(keys)
nv.add(omero.model.NamedValue(keys{i}, values{i}));
end
ma2.setMapValue(nv);
context = java.util.HashMap;
parent = getObjects(session, 'image', imageID );
group = parent(1).getDetails().getGroup().getId().getValue();
mapAnnotation = session.getUpdateService().saveAndReturnObject(...
mapAnnotation, context);
Can I get your help, please? Once I figure it out, I'll turn it into a MATLAB function:
- Code: Select all
mapAnnotation = updateMapAnnotation(session, mapAnnotation, keyvalue, varargin)
mapAnnotationToCellstr.m
https://github.com/openmicroscopy/openm ... oCellstr.m