ome / omero-matlab

Toolbox for accessing OMERO from MATLAB
GNU General Public License v2.0
0 stars 6 forks source link

Str2 map annotation #8

Closed joshmoore closed 5 years ago

joshmoore commented 5 years ago

Copy of openmicroscopy/openmicroscopy#5792


mapAnnotationToCellstr.m components\tools\OmeroM\src\helper

What this PR does

The two MATLAB functions were added to assist manipulation of MapAnnoation objects in MATLAB.

strToMapAnnotation.m components\tools\OmeroM\src\helper mapAnnotationToCellstr.m components\tools\OmeroM\src\helper

Testing this PR

  1. required setup None particularly.

  2. actions to perform

client = loadOmero('demo.openmicroscopy.org', 4064)

str = ["hoge","bar"; "boo","hoo"; "poo",""];
ma = strToMapAnnotation(str)
str2 = mapAnnotationToCellstr(ma)
  1. expected observations

ma is omero.model.MapAnnotationI object. str2 is a cell array of chars.

Related reading

Link to cards, tickets, other PRs:

  1. background for understanding this PR

Handling of MapAnnotation in MATLAB was cumbersome.

  1. what this PR assists, fixes, or otherwise affects

Addition of these functions will simplify the task of editing MapAnnotation objects.

jburel commented 5 years ago

This works as expected. The command to run is ma = strToMapAnnotation(session, str); and not ma = strToMapAnnotation(str); as indicated

dominikl commented 5 years ago

Tested with Matlab 2019a 👍

>> str = ["hoge","bar"; "boo","hoo"; "poo",""];
ma = strToMapAnnotation(session, str)
str2 = mapAnnotationToCellstr(ma)

ma =
omero.model.MapAnnotationI@7dd4f726

str2 =
  3×2 cell array
    {'hoge'}    {'bar'   }
    {'boo' }    {'hoo'   }
    {'poo' }    {0×0 char}