Page 1 of 1

getHypercube in Matlab returns int8

PostPosted: Mon Apr 22, 2013 8:38 pm
by Ajaxel
Hello,
I am trying to use getHypercube from Matlab. In general it works, but it returns the images as the int8, rather than uint8 class. Is it feature or bug?

Thank you!

Re: getHypercube in Matlab returns int8

PostPosted: Tue Apr 23, 2013 8:22 am
by Ajaxel
ok it was similar case with getTile,
got it fixed with:
Code: Select all
tile = store.getTile(z, c, t, minX, minY, width, height);
tPlane = typecast(tile, 'uint8');
tPlane = reshape(tPlane, [width, height])';
tPlane = swapbytes(tPlane);

Re: getHypercube in Matlab returns int8

PostPosted: Tue Apr 23, 2013 9:56 am
by sbesson
Happy to see you fixed it. For information, all the getTile(), getHyperCube()... methods of the raw pixel store return linear java.langByte[] arrays which are automatically casted to int8 in Matlab. They need to be reshaped and casted into the appropriate format as you did.

See also the toMatrix() utility function of the OMERO.matlab toolbox.

Best,
Sebastien

Re: getHypercube in Matlab returns int8

PostPosted: Tue Apr 23, 2013 1:53 pm
by Ajaxel
Hi Sebastien,
right, however the problem with the toMatrix() function is that it probably can't properly reshape the results from getTile function, because it does not know dimensions of the output dataset and takes width/height from the pixels object which may be trimmed.
Or I just did something wrong :?

Re: getHypercube in Matlab returns int8

PostPosted: Wed Apr 24, 2013 9:32 am
by sbesson
You're absolutely right.

Note that improvements have been brought to the toMatrix.m function to pass tile size as an optional argument. These changes will be included in OMERO.matlab 4.4.7 which should be released later on this week.

Sebastien