We're Hiring!

dealing with RawPixelsStore results in 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.

dealing with RawPixelsStore results in matlab

Postby achessel » Wed Sep 26, 2012 1:56 pm

Hi all,

I am using a RawPixelsStore in Matal to crop an hyperstack out of a 3D volume; the method gives back a linear array of byte which, according to the doc, "can and will be interpreted according to results of getByteWidth(), isFloat(), and isSigned()". I would not mind some more detail on how to do that, ie transfrom the linear array of byte into a usable matlab 3D array of float (or whatever).

Is there a documentation (good job on the improved documentation btw!...) page detailing that somewhere? I ran into the reverse problem a while back and the solution I ended up using was not the most concise...

A.
achessel
 
Posts: 67
Joined: Fri Jan 14, 2011 1:58 pm

Re: dealing with RawPixelsStore results in matlab

Postby sbesson » Thu Sep 27, 2012 8:26 am

Hi Anatole,

thanks for you email. I created a ticket to improve our documentation on this matter. OMERO.matlab will be reviewed for 4.5.0 so that we have functions performing this conversion automatically. Let me know if you want to be cc'ed on this ticket.

In the meantime, you can take a look at the Bio-Formats bfGetPlane.m function. This functions converts linear byte arrays into 2D matrices using getBytesPerPixel(), isFloatingPoint(), and isSigned().

Let me know if you need additional information.

Sébastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: dealing with RawPixelsStore results in matlab

Postby achessel » Tue Oct 02, 2012 7:03 pm

Thank you for your answer; having some helper function for that kind of thing would be quite useful indeed...

I ended up doing it manually. I's probably kludgy and hard coded in many ways, but in case it can be of use to others, here it is:
Code: Select all
%once the store is initialised properly:
   st=store.getHypercube(offset, size, step);
   st2=arrayfun(@(x) (typecast([int8(st(2*x)),int8(st(2*x-1))],'uint16')),1:(length(st)/2));
   st3=reshape(st2,sizex,sizey,sizez);           
achessel
 
Posts: 67
Joined: Fri Jan 14, 2011 1:58 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests