Best OMERO API features

I am investigating possible options for building a web application providing access to spatial omic datasets including image preview, thumbnails, which OMERO API endpoints are best to use to do it, Python/Java API or Web? Could you provide some guidance to the available features?

Hi,

If you can get what you need from the various web APIs then that’s certainly the easiest starting point. But none of them give a complete access to everything that OMERO offers, so you may need to resort to the Python API.
You can try various things on the IDR OMERO server https://idr.openmicroscopy.org/, which is configured to allow public web access without a login (see examples below).

The most stable URLs are those documented at https://docs.openmicroscopy.org/omero/5.6.0/developers/json-api.html which give you JSON based on the the full OME model objects.
E.g. Start at https://idr.openmicroscopy.org/api/ or list Projects at https://idr.openmicroscopy.org/api/v0/m/projects/

For thumbnails and image rendering, see https://docs.openmicroscopy.org/omero/5.6.0/developers/Web/WebGateway.html
E.g. https://idr.openmicroscopy.org/webgateway/render_image/179700/0/0/
You can get individual thumbnails like http://idr.openmicroscopy.org/webgateway/render_thumbnail/179700/
In the webclient we’ve switched to batch loading the as JSON, e.g. http://idr.openmicroscopy.org/webgateway/get_thumbnails/?id=224012&id=223942&id=224001&id=223931

JSON data for an image, used in all our image viewers e.g. https://idr.openmicroscopy.org/iviewer/image_data/179700/

All our web clients are built on the Python API using Django.
Start at https://docs.openmicroscopy.org/omero/5.6.0/developers/Web.html

The Python API docs are at
https://docs.openmicroscopy.org/latest/omero/developers/Python.html
Using the Python or Java APIs you can get access to everything the OMERO offers.

Let us know if we can point you at more specific parts of the API for handling particular use-cases you have?

Regards,

Will.

4 Likes

Hi @will-moore,

I am trying to render some image on my web app, most time the URL like https://idr.openmicroscopy.org/webgateway/render_image/179700/0/0/ is working nicely, while for some image I found I need to use render_image_region instead and supply tile parameters as well, like this https://idr.openmicroscopy.org/webclient/img_detail/9822152/?dataset=10201, it calls API https://idr.openmicroscopy.org/webgateway/render_image_region/9822152/0/0/?tile=8,0,0,512,512&c=1|1500:6000$808080&maps=[{“inverted”:{“enabled”:false}}]&m=g&p=normal&q=0.9. my question is how could I tell which image need to use render_image_region instead? I was thinking maybe for experiments/datasets it’s the case, but seems I am wrong.

Thank you in advance for any input!

You will only be able to render the whole image if it is not too big.
You can get essential metadata via the imgData URL. E.g. for the images you mentioned:

https://idr.openmicroscopy.org/webclient/imgData/179700/
https://idr.openmicroscopy.org/webclient/imgData/9822152/

The image first has:

"width": 1344,
"height": 1024,

so it’s possible to render the whole image.

OMERO will use tiles in the viewer when the image is over about 3000 x 3000 pixels.
However, it is possible to render a whole image that is larger than this, but the performance will reduce as the size increases. If the image is over 5000 x 5000 pixels then you should use render_image_region instead.

The ‘big’ tiled image above has:

"width": 144384,
"height": 93184,

and

"zoomLevelScaling": {
"0": 1,
"1": 0.5,
"2": 0.25,
"3": 0.125,
"4": 0.0625,
"5": 0.03125,
"6": 0.015625,
"7": 0.0078125,
"8": 0.00390625
},

This tells you the scaling of the various zoom levels.
E.g. for zoom level 8 will be width 564 and height 364.
You can render the whole plane with https://idr.openmicroscopy.org/webgateway/render_image_region/9822152/0/0/?tile=8,0,0,564,364

or the next largest level (7 - size 1128 * 728) with:
https://idr.openmicroscopy.org/webgateway/render_image_region/9822152/0/0/?tile=7,0,0,1128,728

Hope that helps,

Will

Hi @will-moore,

Sorry for late reply…

Yes, your reply is very helpful! Thank you so much!