Added updateMapAnnotation MATLAB function which allows you to change the content of a MapAnnotation object in OMERO server while keeping the ID of the object.
function ma = updateMapAnnotation(session, ma, keyvalue, varargin)
% updateMapAnnotation will update the content (key-value pairs) of
% MapAnnotation ma while maintaining its ID.
%
% SYNTAX
% ma = updateMapAnnotation(session, ma, keyvalue)
% ma = updateMapAnnotation(____,'Param',value)
%
% INPUT ARGUMENTS
% session omero.api.ServiceFactoryPrxHelper object
%
% ma MapAnnotationI object
%
% keyvalue cell array of characters | string array
% The number of columns must be 2. The first colum is for keys
% and the second column is for values.
%
% OPTIONAL PARA<ETER/VALUE PAIRS
% 'namespace' char
% Namespace for the MapAnnotation. If you specify this, the
% value of 'iseditable' will be ignored.
%
% 'description'
% char
% Description for the MapAnnotation.
%
% 'group' a positive integer
% group ID
%
% 'iseditable'
% false (default) | true | 0 | 1
% If true or 1, MapAnnotation (Key-Value Pairs) will
% be editable via GUI (OMERO.web or OMERO.insight). If you
% specify 'namespace', 'iseditable' will be ignored.
%
%
% OUTPUT ARGUMENTS
% ma MapAnnotationI object
%
%
% Written by Kouichi C. Nakamura Ph.D.
% MRC Brain Network Dynamics Unit
% University of Oxford
% kouichi.c.nakamura@gmail.com
% 05-Dec-2018 18:23:13
%
% See also
% writeMapAnnotation, strToMapAnnotation, mapAnnotationToCellstr
Testing this PR
required setup: You need an image with MapAnnotation on OMERO server
actions to perform.
session = client.createSession(user, password);
ma1 = getObjectAnnotations(session, 'map', 'image', imageID)
s = string(mapAnnotationToCellstr(ma1))
s_ = ["New key","new value";s]
ma2 = updateMapAnnotation(session, ma1, s_, 'iseditable',true)
% check the MapAnnotation form GUI now
% Confirm that it is editable.
ma3 = getObjectAnnotations(session, 'map', 'image', imageID)
s = string(mapAnnotationToCellstr(ma3))
s_ = ["New key 2","new value 2";s]
ma4 = updateMapAnnotation(session, ma3, s_, 'iseditable',false)
% check the MapAnnotation form GUI now
% Confirm that it is editable.
Added
updateMapAnnotation
MATLAB function which allows you to change the content of a MapAnnotation object in OMERO server while keeping the ID of the object.Testing this PR
required setup: You need an image with MapAnnotation on OMERO server
actions to perform.
You can find
mapAnnotationToCellstr
from hereRelated reading
Link to cards, tickets, other PRs:
Originally included in https://github.com/openmicroscopy/openmicroscopy/pull/5925