Page 1 of 1

getFileAnnotationContent retrieve a corrupted file (matlab)

PostPosted: Fri Sep 09, 2016 6:34 am
by jacques2020
Hi,

I am currently attaching image masks within matlab to dataset to retrieve them later. Up to the 5.2.5 version (excluded), it was working fine. However, now, it is no longer possible to retrieve the attached file correctly. Either it is plainly corrupted and trigger an error upon imread (line 23) of example code or it is simply a image filled with 0. Whether I own the dataset used or not (being logged in in the same group) makes no difference. When retrieved using insight, the image mask is correctly retrieved, readable and identical to the original one.
The matlab code used to attach and retrieve the file annotation are similar to the one provided in the documentation for this version of omero.
I would appreciate suggestions to find a fix or at least a work around.

Many thanks

Jacques

Code: Select all
client = loadOmero(servername, port);
session = client.createSession(user, password);
client.enableKeepAlive(60);

I=logical(checkerboard(20));
imwrite(uint8(I),fullfile(pwd,'mask.tif'));

candidateDatasetID= 5862; %8577;

nameOfFile=fullfile(pwd,'mask.tif');
fa= writeFileAnnotation(session, nameOfFile);
iUpdate = session.getUpdateService();
link = linkAnnotation(session,fa,'dataset',candidateDatasetID,session.getAdminService().getEventContext().groupId);
iUpdate.saveObject(link);

faId=fa.getId().getValue();
disp(['Please retrieve annotation ' num2str(faId,'%d') ' using insight client and save it as mask3.tif in the current folder: ' pwd ]);
input('Please press <return> when done');

getFileAnnotationContent(session, faId,fullfile(pwd,'mask2.tif'));

Iorig = imread(nameOfFile);
Iretrieved = imread(fullfile(pwd,'mask2.tif'));
Iinsight = imread(fullfile(pwd,'mask3.tif'));

any(any(Iorig ~= Iretrieved))
any(any(Iorig ~= Iinsight))

all(all(Iorig==0))
all(all(Iretrieved==0))

Re: getFileAnnotationContent retrieve a corrupted file (matl

PostPosted: Fri Sep 09, 2016 8:14 am
by mtbc
Dear Jacques,

It was working okay in 5.2.4 or did you upgrade from earlier? I'm just trying to think what could have changed since your last working version.

Cheers,
Mark

Re: getFileAnnotationContent retrieve a corrupted file (matl

PostPosted: Fri Sep 09, 2016 8:59 am
by jacques2020
Hi Mark,

sorry, I would have thought to precise: I upgraded from 5.2.2

Cheers

JAcques

Re: getFileAnnotationContent retrieve a corrupted file (matl

PostPosted: Fri Sep 09, 2016 11:19 am
by bramalingam
Hi,

Thank you for submitting your issue.

Yes we had a PR merged post 5.2.2, that has caused this regression.
And we have currently pushed a fix for the same,
https://github.com/openmicroscopy/openm ... /pull/4831

and this will most probably be available from the next stable release of OMERO.

For the time being, please copy the code change as suggested in the link below,
https://github.com/openmicroscopy/openm ... 4831/files
(edit file : */annotations/getOriginalFileContent.m under the matlab toolbox with the change suggested in the PR)

This should solve your issue for the time being.
Hope that helps.

Best,
Balaji

Re: getFileAnnotationContent retrieve a corrupted file (matl

PostPosted: Tue Sep 13, 2016 6:41 am
by jacques2020
Dear Balaji,

thank you for the fix. It solved our issue.

Best

Jacques