getFileAnnotationContent retrieve a corrupted file (matlab)
Posted: 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
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))