[ome-devel] Getting an image out of OMERO
Jean-marie Burel
j.burel at dundee.ac.uk
Fri Jun 27 14:36:04 BST 2008
Hi Matthias
in order to retrieve the correct data
you need the pixels ID related to the image not the image ID.
then depending on what you want to do
you can
1. use the thumbnail service to retrieve compressed data
2. use the rendering engine to get compressed or uncompressed data.
3. use the RawPixelsStore to retrieve the raw data
1. go to the OmeroImageServiceImpl in env/data
private ServiceFactory entry;
ThumbnailStore service = entry.createThumbnailService();
if (!(service.setPixelsId(pixelsID))) { *
service.resetDefaults();
service.setPixelsId(pixelsID);
}
byte[] array = service.getThumbnail(new Integer(sizeX), new Integer(sizeY));
where sizeX = maxWidth, sizeY= maxHeight for example.
The thumbnail store provides other useful methods, see Java doc.
If you use set of images you should use the method related to collection
in that case the code marked with * is not required.
2.
RenderingEngine re = entry.createRenderingEngine();
re.setCompressionLevel(compression); //optional only for compressed data
service.lookupPixels(pixelsID);
needDefault(pixelsID, service);
if (!(re.lookupRenderingDef(pixelsID))) {
re.resetDefaults();
re.lookupRenderingDef(pixelsID);
}
re.load();
uncompressed
int[] buf = re.renderAsPackedInt(pDef);
compressed
byte[] values = re.renderCompressed(pDef);
where pDef is planeDef indicating the plane to retrieve
e.g.
PlaneDef pDef = new PlaneDef(PlaneDef.XY, getDefaultT());
pDef.setZ(getDefaultZ());
3. to retrieve a plane for example.
RawPixelsStore service =entry.createRawPixelsStore();
service.setPixelsId(pixelsID);
byte[] array = service.getPlane(z, c, t);
2 is the approach for the Viewer
1 when we browse thumbnails.
Hope it helps
I can point to the classes or packages if you need
Cheers
Jmarie
The University of Dundee is a registered Scottish charity, No: SC015096
More information about the ome-devel
mailing list