[ome-devel] Linking Omero and Catmaid

Phan Minh-Son (M.) minh-son.phan at polytechnique.edu
Thu May 18 13:17:54 BST 2017


Hi, 


De: "William Moore (Staff)" <W.Moore at dundee.ac.uk> 
À: "ome-devel" <ome-devel at lists.openmicroscopy.org.uk> 
Envoyé: Mercredi 17 Mai 2017 12:32:24 
Objet: Re: [ome-devel] Linking Omero and Catmaid 

Hi, 

The imageWrapper will need to initialise it’s rendering engine to do the renderJpegRegion() anyway, so 
you won’t save any time by omitting the img.getZoomLevelScaling(). 
This doesn’t take any extra time over-and-above the initialisation of the rendering engine, at least in my tests. 

> Yes, there's no different by removing getZoomLevelScaling() since the decorator @assert_re() is always asked before running renderJpegRegion(). 

We have previously explored the option of keeping the rendering engine open between http requests, 
but this is dangerous as they can get left open indefinitely and consume resources until they are closed. 

> So we can not keep the rendering engine during the session :(. Thank you so much for your advice. 

You may find that you can reduce the number of requests needed by increasing the size of tiles 
that you’re requesting. That way you'll get more data for each initialisation of the rendering engine. 

> Yes, we're testing the loading time performance according to the tile size, zoom level and jpeg compression ratio. 

Another option that may be useful if you’re repeatedly opening the same images with the same 
rendering settings is to cache tiles in the web server. We’ve used this approach for 
public data repositories (IDR) but I’m afraid it won’t make things any faster for the first time an image is opened. 

> We also used this option. 

It’s also possible that hardware is a limiting factor. 
See https://www.openmicroscopy.org/site/support/omero5.3/sysadmins/system-requirements.html 

> Thank you very much for all your suggestions :) 


Regards, 

Will 


Regards, 

Son 




On 16 May 2017, at 13:24, Phan Minh-Son (M.) < minh-son.phan at polytechnique.edu > wrote: 

Hi, 

Our Omero webapp https://github.com/msphan/omero-catmaid is now able to fetch image tiles from Omero and visualize on Catmaid. Thanks again for all your help. The loading time of each image tile is about 3s and I wonder if we could still reduce it. As mentioned in the previous mails, there are two important functions: getZoomLevelScaling() and renderJpegRegion() in ImageWrapper class. However, in our case, the image tile is requested multiple times on a same image dataset when the user logged in, and the only difference may be the renderJpegRegion(). 

The running time of the getZoomLevelScaling() is about 1.8s regardless of the zoom level and the tile size. I think it relates to the decorator @assert_re() which is used to prepare image rendering. It would be nice if we create the ImageWrapper instance and prepare image rendering only one time at the first GET request of each session. Are there any ways to deal with this? Thank you so much. 

Son 


De: "Phan Minh-Son (M.)" < minh-son.phan at polytechnique.edu > 
À: "ome-devel" < ome-devel at lists.openmicroscopy.org.uk > 
Envoyé: Vendredi 12 Mai 2017 12:01:43 
Objet: Re: [ome-devel] Linking Omero and Catmaid 

Hi Will, 

Thank you very much for your efforts :). I tested your code, and it worked well in our case of tiff image. The loading time is now almost the same for all zoom levels. Moreover, the scalex and scaley values can be calculated from Catmaid, so the code will be even nicer. 

Thank you again !! 

Cheers, 

Son 


De: "William Moore (Staff)" < W.Moore at dundee.ac.uk > 
À: "ome-devel" < ome-devel at lists.openmicroscopy.org.uk > 
Envoyé: Jeudi 11 Mai 2017 22:42:55 
Objet: Re: [ome-devel] Linking Omero and Catmaid 

Hi Son, 

I got this working for me, and opened a PR with my code: https://github.com/msphan/omero-catmaid/pull/1 

NB: This uses whatever zoom levels are provided for the image (depends on file format) so it may 
not always be a zoom factor of 2 between adjacent zoom levels. 

Let meek know if this works or if you have any problems. 

Regards, 

Will. 



BQ_BEGIN

On 11 May 2017, at 13:15, William Moore (Staff) < wmoore at dundee.ac.uk > wrote: 

Hi, 

It’s great to see a new OMERO.web app and nice that Catmaid can talk to OMERO! 

- Authentication: If you log in to OMERO.web (e.g. /webclient/) in the same browser you’re running Catmaid, then all subsequent 
requests should be able to use the sessionId in the cookie to re-connect to OMERO with the login_required decorator you’ve used. 

- Parallel loading of image tiles: Yes, every request is asynchronously handled by individual web server workers. If you’re using the 
development server then there’s only a single process, but when deployed using nginx there’ll typically be 5 workers handling requests in parallel. 

- Image tile zoom: You’ll need to use the ‘level’ parameter of img.renderJpegRegion(z, t, scalex, scaley, scalew, scaleh, level=level, compression=c) 
However, this works in the opposite direction from ‘zoom’ in your API: level=0 is the most zoomed-out level. 

If you do img.getZoomLevelScaling() 
you’ll get a dictionary of supported zoom levels for the image, and the relative zoom fractions. 
e.g. {0: 1.0, 1: 0.24999023831526337, 2: 0.06248779789407921, 3: 0.031237391157215185, 4: 0.010451510458018247} 
NB: with all the different formats that OMERO / Bio-Formats supports, many do not zoom 2x with each zoom level, as you can see from this svs image example. 

In this image, zooming from level 0 (most zoomed out) to level 4 will give a zoom of ~95 x (1/0.01045). 
In your case, zm=0 would be level 4 (with x and y unchanged). 
Zooming to zm=1 would be level 3 but then you have to scale the x and y accordingly since these no-longer map to the original image size. 
I’m afraid I don’t have time to work out the exact logic for this but hopefully you can figure this out. 
Let us know if you need more help. 
This should mean that you don’t need to resize the image with PIL. 

Other points: 

Your install instructions: $ OMERO.py/bin/omero config append omero.web.apps '"omero-catmaid"' 
This should be “omero_catmaid” (underscore instead of -). 

You’re also missing a Http404 import 
from django.http import Http404 

Regards, 

Will. 



BQ_BEGIN

On 10 May 2017, at 12:53, Phan Minh-Son (M.) < minh-son.phan at polytechnique.edu > wrote: 



Dear all, 


We've just built a simple Omero web app : https://github.com/msphan/omero-catmaid . It is designed to serve the url convention in Catmaid which is a software for visualization and annotation of large scale image ( http://catmaid.readthedocs.io ). 
In brief, the func render_tile() in our app is rewritten from the func render_image_region() in webgateway by modifying the url format, handling the tile zoom level. The code is still very simple, there are several aspects that could be optimized. We would highly appreciate any comments, advices you may provide. 

- Authentication: we now use a session key added into url to handle the Omero login request. However, this requires modification of url setup in Catmaid each time when we login into Omero. Are there other alternative ways for the login process? 

- Parallel loading of image tile: since Catmaid support this feature, so is it also possible in Omero to respond the parallel requests? 

- Image tile zoom: in render_tile() func, we simply calculate scaled size of image tile at a specified zoom level, then render the jpeg using renderJpegRegion() and finally resize it. The code is quite redundant and the render speed depends on the zoom level. So for a very large image, the render tile speed is slow for high values of zoom level. Would you have any comments/advices to speed up the render tile? 

Many thanks and best regards, 



Son 



_______________________________________________ 
ome-devel mailing list 
ome-devel at lists.openmicroscopy.org.uk 
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel 





BQ_END



The University of Dundee is a registered Scottish Charity, No: SC015096 
_______________________________________________ 
ome-devel mailing list 
ome-devel at lists.openmicroscopy.org.uk 
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel 

_______________________________________________ 
ome-devel mailing list 
ome-devel at lists.openmicroscopy.org.uk 
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel 

BQ_END



The University of Dundee is a registered Scottish Charity, No: SC015096 
_______________________________________________ 
ome-devel mailing list 
ome-devel at lists.openmicroscopy.org.uk 
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20170518/c9fa297e/attachment.html>


More information about the ome-devel mailing list