<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi,<br></div><div><br data-mce-bogus="1"></div><div>Our Omero webapp <a href="https://github.com/msphan/omero-catmaid/pull/1" class="" target="_blank" data-mce-href="https://github.com/msphan/omero-catmaid/pull/1">https://github.com/msphan/omero-catmaid</a> 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(). </div><div><br data-mce-bogus="1"></div><div>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.<br data-mce-bogus="1"></div><div><br></div><div data-marker="__SIG_PRE__">Son</div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>De: </b>"Phan Minh-Son (M.)" <minh-son.phan@polytechnique.edu><br><b>À: </b>"ome-devel" <ome-devel@lists.openmicroscopy.org.uk><br><b>Envoyé: </b>Vendredi 12 Mai 2017 12:01:43<br><b>Objet: </b>Re: [ome-devel] Linking Omero and Catmaid<br></div><div><br></div><div data-marker="__QUOTED_TEXT__"><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi Will,<br></div><br><div>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. </div><br><div>Thank you again !!<br></div><br><div>Cheers,<br></div><br><div>Son</div><br><hr id="zwchr"><div><b>De: </b>"William Moore (Staff)" <W.Moore@dundee.ac.uk><br><b>À: </b>"ome-devel" <ome-devel@lists.openmicroscopy.org.uk><br><b>Envoyé: </b>Jeudi 11 Mai 2017 22:42:55<br><b>Objet: </b>Re: [ome-devel] Linking Omero and Catmaid<br></div><br><div>
Hi Son,
<div class=""><br class="">
</div>
<div class=""> I got this working for me, and opened a PR with my code: <a href="https://github.com/msphan/omero-catmaid/pull/1" class="" target="_blank">https://github.com/msphan/omero-catmaid/pull/1</a><br></div>
<div class=""><br class="">
</div>
<div class="">NB: This uses whatever zoom levels are provided for the image (depends on file format) so it may</div>
<div class="">not always be a zoom factor of 2 between adjacent zoom levels.</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">Let meek know if this works or if you have any problems.</div>
</div>
<div class=""><br class="">
</div>
<div class=""> Regards,</div>
<div class=""><br class="">
</div>
<div class="">  Will.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote class="">
<div class="">On 11 May 2017, at 13:15, William Moore (Staff) <<a href="mailto:wmoore@dundee.ac.uk" class="" target="_blank">wmoore@dundee.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi,
<div class=""><br class="">
</div>
<div class=""> It’s great to see a new OMERO.web app and nice that Catmaid can talk to OMERO!</div>
<div class=""><br class="">
</div>
<div class=""> - Authentication: If you log in to OMERO.web (e.g. /webclient/) in the same browser you’re running Catmaid, then all subsequent</div>
<div class="">requests should be able to use the sessionId in the cookie to re-connect to OMERO with the login_required decorator you’ve used.</div>
<div class=""><br class="">
</div>
<div class=""> - Parallel loading of image tiles: Yes, every request is asynchronously handled by individual web server workers. If you’re using the</div>
<div class="">development server then there’s only a single process, but when deployed using nginx there’ll typically be 5 workers handling requests in parallel.</div>
<div class=""><br class="">
</div>
<div class=""> - Image tile zoom: You’ll need to use the ‘level’ parameter of img.renderJpegRegion(z, t, scalex, scaley, scalew, scaleh, level=level, compression=c)</div>
<div class="">However, this works in the opposite direction from ‘zoom’ in your API: level=0 is the most zoomed-out level. </div>
<div class=""><br class="">
</div>
<div class="">If you do  img.getZoomLevelScaling()</div>
<div class="">you’ll get a dictionary of supported zoom levels for the image, and the relative zoom fractions.</div>
<div class="">e.g. <span style="color: rgb(76, 47, 45); font-family: Courier; background-color: rgb(223, 219, 196);" class="">{0: 1.0, 1: 0.24999023831526337, 2: 0.06248779789407921, 3: 0.031237391157215185, 4: 0.010451510458018247}</span></div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">In this image, zooming from level 0 (most zoomed out) to level 4 will give a zoom of ~95 x (1/0.01045).</div>
<div class="">In your case, zm=0 would be level 4 (with x and y unchanged).</div>
<div class="">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.</div>
<div class="">I’m afraid I don’t have time to work out the exact logic for this but hopefully you can figure this out.</div>
<div class="">Let us know if you need more help.</div>
<div class="">This should mean that you don’t need to resize the image with PIL.</div>
<div class=""><br class="">
</div>
<div class="">Other points:</div>
<div class=""><br class="">
</div>
<div class="">Your install instructions: <span style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; color: rgb(36, 41, 46); orphans: 2; widows: 2;" class="">$ OMERO.py/bin/omero
 config append omero.web.apps '"omero-catmaid"'</span></div>
<div class="">This should be “omero_catmaid” (underscore instead of -).</div>
<div class=""><br class="">
</div>
<div class="">You’re also missing a Http404 import</div>
<div class="">from django.http import Http404</div>
<div class=""><br class="">
</div>
<div class=""> Regards,</div>
<div class=""><br class="">
</div>
<div class="">  Will.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class="">
<blockquote class="">
<div class="">On 10 May 2017, at 12:53, Phan Minh-Son (M.) <<a href="mailto:minh-son.phan@polytechnique.edu" class="" target="_blank">minh-son.phan@polytechnique.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" class="">
<p class="">Dear all,<br class="">
</p>
<p class="">We've just built a simple Omero web app<span class="Object" id="OBJ_PREFIX_DWT564_com_zimbra_url">:
<a href="https://github.com/msphan/omero-catmaid" class="" target="_blank">https://github.com/msphan/omero-catmaid</a>. It is
</span>designed to serve the url convention in Catmaid which is a software for visualization and annotation of large scale image (<a href="http://catmaid.readthedocs.io/" class="" target="_blank">http://catmaid.readthedocs.io</a>).<br class="">
</p>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">- 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?</div>
<div class=""><br class="">
</div>
<div class="">- Parallel loading of image tile: since Catmaid support this feature, so is it also possible in Omero to respond the parallel requests?</div>
<div class=""><br class="">
</div>
<div class="">- 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?</div>
<div class=""><br class="">
</div>
<div class="">Many thanks and best regards,<br class="">
</div>
<div class=""><br class="webkit-block-placeholder">
</div>
<p class="">Son</p>
<p class=""><br class="">
</p>
<div class=""><br class="">
</div>
</div>
</div>
_______________________________________________<br class="">
ome-devel mailing list<br class="">
<a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="" target="_blank">ome-devel@lists.openmicroscopy.org.uk</a><br class="">
<a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel" class="" target="_blank">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<span style="font-size:10pt;">The University of Dundee is a registered Scottish Charity, No: SC015096</span>


<br>_______________________________________________<br>ome-devel mailing list<br>ome-devel@lists.openmicroscopy.org.uk<br>http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</div></div><br></div></div></body></html>