[MATLAB] Import image to matlab
Posted:
Tue Oct 30, 2012 8:57 am
by moritz.buck
A long thread on uploading to omero from matlab is there, but I have not seen the other story.
Basically, I just wanted to know if there is a simple function already implemented which basically takes an image ID and spits out a directly useable image matrix?
Thanks anyhow,
Re: [MATLAB] Import image to matlab
Posted:
Tue Oct 30, 2012 9:29 am
by sbesson
Hi Moritz,
there is no single function which does exactly what you want. However, such a function can be easily written using OMERO.matlab.
Below is a script example which connects to a server, load the image imageId and reads its first plane as a matrix.
- Code: Select all
% Connect to the server
loadOmero
client = omero.client(server, port);
session = client.createSession(user, password);
% Get the image specified by imageId (integer or double)
ids = java.util.ArrayList();
ids.add(java.lang.Long(imageId));
proxy = session.getContainerService();
list = proxy.getImages('omero.model.Image', ids, omero.sys.ParametersI());
image = list.get(0);
% Get the pixels
pixelsList = image.copyPixels();
pixels = pixelsList.get(0);
pixelsId = pixels.getId().getValue();
% Initialize the rawPixelsStore and get the first plane
store = session.createRawPixelsStore();
store.setPixelsId(pixelsId, false);
plane = store.getPlane(0, 0, 0);
plane = toMatrix(plane, pixels);
More information is available on
https://www.openmicroscopy.org/site/support/omero4/developers/Matlab.html.
Sebastien
Re: [MATLAB] Import image to matlab
Posted:
Tue Oct 30, 2012 9:32 am
by moritz.buck
Ok, it is so then,
thank you,