Page 1 of 1

Matlab, get pixel size

PostPosted: Tue Apr 23, 2013 3:16 pm
by Ajaxel
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!

Re: Matlab, get pixel size

PostPosted: Wed Apr 24, 2013 8:03 am
by sbesson
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

Re: Matlab, get pixel size

PostPosted: Thu Apr 25, 2013 11:03 am
by Ajaxel
thank you it works!
It is getPhysicalSizeX() method!

Re: Matlab, get pixels, metadata

PostPosted: Sat Mar 08, 2014 6:25 pm
by bhavna
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.

Re: Matlab, get pixel size

PostPosted: Sun Mar 09, 2014 8:19 pm
by sbesson
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