We're Hiring!

getFileAnnotationContent retrieve a corrupted file (matlab)

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

getFileAnnotationContent retrieve a corrupted file (matlab)

Postby jacques2020 » Fri Sep 09, 2016 6:34 am

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))
jacques2020
 
Posts: 102
Joined: Fri Jul 15, 2011 7:46 am

Re: getFileAnnotationContent retrieve a corrupted file (matl

Postby mtbc » Fri Sep 09, 2016 8:14 am

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
User avatar
mtbc
Team Member
 
Posts: 282
Joined: Tue Oct 23, 2012 10:59 am
Location: Dundee, Scotland

Re: getFileAnnotationContent retrieve a corrupted file (matl

Postby jacques2020 » Fri Sep 09, 2016 8:59 am

Hi Mark,

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

Cheers

JAcques
jacques2020
 
Posts: 102
Joined: Fri Jul 15, 2011 7:46 am

Re: getFileAnnotationContent retrieve a corrupted file (matl

Postby bramalingam » Fri Sep 09, 2016 11:19 am

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
User avatar
bramalingam
 
Posts: 70
Joined: Tue Jan 14, 2014 12:01 pm

Re: getFileAnnotationContent retrieve a corrupted file (matl

Postby jacques2020 » Tue Sep 13, 2016 6:41 am

Dear Balaji,

thank you for the fix. It solved our issue.

Best

Jacques
jacques2020
 
Posts: 102
Joined: Fri Jul 15, 2011 7:46 am


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests