ome / omero-matlab

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

Link annotation #7

Closed joshmoore closed 5 years ago

joshmoore commented 6 years ago

Copy of https://github.com/openmicroscopy/openmicroscopy/pull/5799


What this PR does

linkAnnotation supports parentID as a vector.

The input validation for parent ID accepts vector but running the function with parentID as a vector issued an error.

https://github.com/openmicroscopy/openmicroscopy/blob/c60092a554f8295c2992c407a94a2623011306b5/components/tools/OmeroM/src/annotations/linkAnnotation.m#L38

To avoid this issue, I added a for loop.

Testing this PR

  1. required setup

You need at least two images as parents of a tag annotation.

  1. actions to perform
eval('import omero.model.TagAnnotationI')

tag1 = TagAnnotationI;
tag1.setTextValue(rstring('Super cool'));

img_ids = [1 2]; % two images

linkAnnotation(session, tag1, 'image', img_ids );
  1. expected observations

The modified version of linkAnnotation should link the tag to three images.

Related reading

Link to cards, tickets, other PRs:

  1. background for understanding this PR

Although InputParser of linkAnnotation accepts parentID as vector, it was not supported.

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

Part of the problem was the poor documentation, so I added a lot more specifications to the comments.

jburel commented 5 years ago

passing an empty list of parent IDs enters in an infinite loop

jburel commented 5 years ago

To test the last commit, run the example described in the description but the array is empty i.e. img_ids = []

dominikl commented 5 years ago

Works like described; and with an empty array I get No image specified 👍