[ome-users] omero Beta4: Displaying an image from omero in matlab
donald
donald at lifesci.dundee.ac.uk
Tue Feb 17 14:20:49 GMT 2009
Hi Bram,
Sorry, the Gateway methods are in the middle of being changed. I'm
going to write doc for them in a couple of days.
When we moved the Gateway from the client to the server as a service
some of the methods became inappropriate for a server side call (too
much data being sent, or just nor correct). There are methods now in
the OMEROJava directory under the util part the class is called
GatewayUtils and it should do a lot of that for you.
http://trac.openmicroscopy.org.uk/omero/browser/trunk/components/tools/OmeroJava/src/omerojava/util/GatewayUtils.java
client = omero.client('localhost');
session = client.createSession('root','ome');
gateway = session.createGateway();
p = gateway.getPixels(57);
renderedImage = omerojava.util.GatewayUtils.toBufferedImage(p, image)
If you find any errors or wish new methods added please don't hesitate
to ask.
If you have code you wish to add please feel free, that would be
excellent. :-)
Regards
Donald
On Feb 17, 2009, at 12:50 PM, <b.gerritsen at nki.nl> wrote:
> Dear all,
>
> Some of the omero matlab scripts in the trunk do not work for me.
> Displaying an image from omero in matlab failed for me. After
> checking out the api it looks like the getPlane() function was to
> blame as it has changed from the previous version:
>
> (copied directly from the docs for beta4 )
> ---
>
> byte[] getPlane(long pixelsId, int z, int c, int t, Ice.Current
> current)
> Get the raw plane for the pixels pixelsId, this returns a 2d
> array representing the plane, it returns doubles but will not lose
> data.
>
> ---
>
> The returned array is one-dimensional and not two as the comment
> states. Although I'm new to both omero and matlab, I wrote a matlab
> function (see below) that displays images from omero. It works for
> the tiff files that I'm uploading into omero. If there are better
> ways to do it, please let me know!
>
> Thanks!
> Bram Gerritsen
>
>
> ------------------------------------------
>
> function drawImage(hostname, username, password, pixelsId)
> omeroGateway = createOmeroJavaService(hostname, username, password);
> pixels = omeroGateway.getPixels(pixelsId);
> pixelType = pixels.getPixelsType.getValue.getValue.toCharArray;
>
> plane = swapbytes (typecast (omeroGateway.getPlane(pixelsId, 0, 0,
> 0), pixelType)); % OMERO uses Big Endian whereas intel systems use
> Little Endian
>
> sizeX = pixels.getSizeX.getValue;
> sizeY = pixels.getSizeY.getValue;
> total = sizeX*sizeY;
>
> rgbImage = zeros (sizeX, sizeY, 3, pixelType);
> for j=1:sizeY,
> for i=1:sizeX,
> rgbImage(i, j, 1)=plane ( (j-1)*sizeX + i);
> rgbImage(i, j, 2)=plane ( (j-1)*sizeX + i);
> rgbImage(i, j, 3)=plane ( (j-1)*sizeX + i);
> end
> end
>
> figure(1);
> image (rgbImage);
> drawnow;
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
More information about the ome-users
mailing list