We're Hiring!

Matlab, get pixel size

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.

Matlab, get pixel size

Postby Ajaxel » Tue Apr 23, 2013 3:16 pm

Hello,
did not find it in the OMERO Matlab language bindings tutorial nor elsewhere...
How to get pixel size information from matlab?
Is it somewhere in
metadataService = session.getMetadataService();

thank you!
Ajaxel
 
Posts: 14
Joined: Mon Apr 22, 2013 8:33 pm

Re: Matlab, get pixel size

Postby sbesson » Wed Apr 24, 2013 8:03 am

Hi,
assuming you loaded your image using the container service, the image dimensions should be accessible from the pixels using:

Code: Select all
sizeX = image.getPrimaryPixels().getSizeX().getValue()
sizeY = image.getPrimaryPixels().getSizeY().getValue()
..


and the physical pixel sizes using:

Code: Select all
physicalSizeX = image.getPrimaryPixels().getPhysicalSizeX().getValue()
physicalSizeY = image.getPrimaryPixels().getPhysicalSizeY().getValue()
...


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

Re: Matlab, get pixel size

Postby Ajaxel » Thu Apr 25, 2013 11:03 am

thank you it works!
It is getPhysicalSizeX() method!
Ajaxel
 
Posts: 14
Joined: Mon Apr 22, 2013 8:33 pm

Re: Matlab, get pixels, metadata

Postby bhavna » Sat Mar 08, 2014 6:25 pm

Hi,
I just started using the omero server and was able to connect from matlab.
how can we retrive the dimensions of the image and the actual pixel values?
For eg.,
pixels=images(1).getPrimaryPixels();
creates a pointer, but dosnt give the actual pixels ? I am not so familier with java codes..
Are there typical methods mentioned to access the metadata.
Also, how do we retreive the entire metadata in matlab?
Thank You,
Bhavna.
bhavna
 
Posts: 1
Joined: Fri Mar 07, 2014 3:45 pm

Re: Matlab, get pixel size

Postby sbesson » Sun Mar 09, 2014 8:19 pm

Hi Bhavna,

Code: Select all
image(1).getPrimaryPixels()


returns a Pixels object, as defined by the OME-XML model. It allows you to access the metadata associated to the Pixels object, e.g.

Code: Select all
image(1).getPrimaryPixels.getSizeX()
image(1).getPrimaryPixels.getSizeY()
image(1).getPrimaryPixels.getSizeZ()
image(1).getPrimaryPixels.getPhysicalSizeX()
...


To access the raw pixel data, you can use the helper methods of the OMERO.matlab toolbox as described in the OMERO developer documentation. For instance to retrieve the plane at coordinates (0,0,0), you can use:

Code: Select all
plane = getPlane(session, image(1), 0, 0, 0);


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