We're Hiring!

getHypercube in Matlab returns int8

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.

getHypercube in Matlab returns int8

Postby Ajaxel » Mon Apr 22, 2013 8:38 pm

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!
Ajaxel
 
Posts: 14
Joined: Mon Apr 22, 2013 8:33 pm

Re: getHypercube in Matlab returns int8

Postby Ajaxel » Tue Apr 23, 2013 8:22 am

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);
Ajaxel
 
Posts: 14
Joined: Mon Apr 22, 2013 8:33 pm

Re: getHypercube in Matlab returns int8

Postby sbesson » Tue Apr 23, 2013 9:56 am

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: getHypercube in Matlab returns int8

Postby Ajaxel » Tue Apr 23, 2013 1:53 pm

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 :?
Ajaxel
 
Posts: 14
Joined: Mon Apr 22, 2013 8:33 pm

Re: getHypercube in Matlab returns int8

Postby sbesson » Wed Apr 24, 2013 9:32 am

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
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest