<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Sorry, it was a reminder. I should have updated to 5.1.3 and checked this.<div class="">Thanks for implementing this.</div><div class=""><br class=""></div><div class="">PD: We will add the omero logo to the PDBe page of the volume slicer on release.<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 27 Aug 2015, at 15:27, Aleksandra Tarkowska (Staff) <<a href="mailto:A.Tarkowska@dundee.ac.uk" class="">A.Tarkowska@dundee.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;" class="">
<div class="">
<div class="">Hi <span style="font-family: Calibri; font-size: 15px; text-align: left; " class="">José,</span></div>
<div class="">
<div class=""><br class="">
</div>
<div class="">Thanks for your email.</div>
<div class=""><br class="">
</div>
<div class="">I am not sure if I follow it correctly but as far as I can see<b class=""> webgateway.views.render_image_region </b>already support quality.</div>
<div class=""><br class="">
</div>
<div class=""><a href="https://server/webgateway/render_image_region/IMAGE_ID/PLANE_ID/0/?q=0.5®ion=x,y,w,h" class="">https://server/webgateway/render_image_region/IMAGE_ID/PLANE_ID/0/?q=0.5®ion=x,y,w,h</a> </div>
<div class=""><br class="">
</div>
<div class="">see: <a href="https://github.com/openmicroscopy/openmicroscopy/blob/dev_5_1/components/tools/OmeroWeb/omeroweb/webgateway/views.py#L742" class="">https://github.com/openmicroscopy/openmicroscopy/blob/dev_5_1/components/tools/OmeroWeb/omeroweb/webgateway/views.py#L742</a></div>
<div class="">and <a href="https://github.com/openmicroscopy/openmicroscopy/blob/dev_5_1/components/tools/OmeroWeb/omeroweb/webgateway/views.py#L775" class="">
https://github.com/openmicroscopy/openmicroscopy/blob/dev_5_1/components/tools/OmeroWeb/omeroweb/webgateway/views.py#L775</a></div>
<div class=""><br class="">
</div>
<div class="">Although it is true that quality is not taken to the account in webgateway_cache.</div>
<div class=""><br class="">
</div>
<div class="">Thanks for letting us know. I have created ticket to fix webgateway_cache in <a href="https://trac.openmicroscopy.org/ome/ticket/13011" class="">https://trac.openmicroscopy.org/ome/ticket/13011</a></div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">Kind regards</div>
<div class="">Ola</div>
</div>
</div>
</div>
<div class=""><br class="">
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223);" class="">
<span style="font-weight:bold" class="">From: </span>José Salavert Torres <<a href="mailto:josator@ebi.ac.uk" class="">josator@ebi.ac.uk</a>><br class="">
<span style="font-weight:bold" class="">Reply-To: </span>OME External Developer List <<a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="">ome-devel@lists.openmicroscopy.org.uk</a>><br class="">
<span style="font-weight:bold" class="">Date: </span>Thu, 27 Aug 2015 14:46:53 +0100<br class="">
<span style="font-weight:bold" class="">To: </span>OME External Developer List <<a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="">ome-devel@lists.openmicroscopy.org.uk</a>><br class="">
<span style="font-weight:bold" class="">Subject: </span>[ome-devel] Request for functionality on OMERO WebGateway in version 5.1.4<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Dear all,
<div class=""><br class="">
</div>
<div class="">We requested in a meeting some time ago in a meeting a new functionality in the render_image_region on the web gateway of omero web.</div>
<div class=""><br class="">
</div>
<div class="">Concretely we want to have the possibility to select the quality of the jpeg sent by the server. This is the code we currently added to achieve that:</div>
<div class=""><br class="">
</div>
<div class="">On web gateway <em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">openmicroscopy/components/<span data-mce-style="line-height: 1.4285715;" style="line-height: 1.4285715;" class="">tools/OmeroWeb/omeroweb/webgateway/urls.py</span></em> file:</div>
<div class=""><br class="">
</div>
<div class=""><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">render_image_region_quality = ( r'^render_image_region_quality/(?P<iid>[^/]+)/(?P<z>[^/]+)/(?P<t>[^/]+)/(?P<q>[^/]+)/$',</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class=""> 'webgateway.views.render_image_region_quality')</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">"""</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">Returns a jpeg of the OMERO image, rendering only a region specified in query string as</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">region=x,y,width,height. E.g. region=0,512,256,256. If the image is much bigger than the</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">indicated baseline size, it is resized with Pillow. See L{views.render_image_region_quality}. </em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">Rendering settings can be specified in the request parameters.</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">Params in render_image/<iid>/<z>/<t>/</em><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class=""><q>/</em><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class=""> are:</em></div>
<div class=""><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">- iid: Image ID</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">- z: Z index</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">- t: T index</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">- q: JPEG quality of the returned image</em><br style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class="">
<em class=""><font color="#333333" face="Arial,sans-serif" class=""><span style="font-size: 14px; line-height: 20px;" class="">“”"</span></font></em></div>
<div class=""><em class=""><font color="#333333" face="Arial,sans-serif" class=""><span style="font-size: 14px; line-height: 20px;" class=""><br class="">
</span></font></em></div>
<div class=""><font color="#333333" face="Arial,sans-serif" class=""><span style="font-size: 14px; line-height: 20px;" class="">On web gateway </span></font><font color="#333333" face="Arial,sans-serif" class=""><span style="font-size: 14px; line-height: 20px;" class=""><i class="">openmicroscopy/components/tools/OmeroWeb/omeroweb/webgateway/views.py
</i>file (notice the small differences with the original render_image_region call, we add the quality in the ctx parameter of the web gateway_cache and the value of </span></font><b class=""><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); " class="">float(q)
/</span><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); " class=""> </span></b><span data-mce-style="color: #941100;" style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); " class=""><b class="">100.0</b><font color="#941100" class=""> </font></span><font color="#333333" face="Arial,sans-serif" class=""><span style="font-size: 14px; line-height: 20px;" class="">in
the compression parameter of the </span></font><span style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); " class=""><b class="">renderJpegRegion</b> function</span><font color="#333333" face="Arial,sans-serif" class=""><span style="font-size: 14px; line-height: 20px;" class="">):</span></font></div>
<div class=""><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class=""><br class="">
</em></div>
<div class=""><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@login_required<span data-mce-style="color: #000000;" style="" class="">()</span></p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">def</span> render_image_region_quality(request, iid, z, t, q, conn=<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span>, **kwargs):</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">"""</span></p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
Returns a jpeg of the OMERO image, rendering only a region specified in query string as</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
region=x,y,width,height and resizing it. E.g. region=0,512,256,256</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
Rendering settings can be specified in the request parameters.</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@param request: http request</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@param iid: image ID</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@param z: Z index</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@param t: T index</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@param q: Jpeg compression quality</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@param conn: L{omero.gateway.BlitzGateway} connection</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
@return: http response wrapping jpeg</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
"""</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
server_id = request.session[<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">'connector'</span>].server_id</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span># if the region=x,y,w,h is not parsed correctly to give 4 ints then we simply provide whole image plane.</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span># alternatively, could return a 404?</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span>#if h == None:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span># return render_image (request, iid, z, t, server_id=None, _conn=None, **kwargs)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
pi = _get_prepared_image(request, iid, server_id=server_id, conn=conn)</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">if</span> pi <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">is</span> <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">raise</span> Http404</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
img, compress_quality = pi</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
tile = request.REQUEST.get(<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">'tile'</span>, <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span>)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
region = request.REQUEST.get(<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">'region'</span>, <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span>)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
level = <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span></p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">if</span> tile:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">try</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
img._prepareRenderingEngine()</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
w, h = img._re.getTileSize()</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
levels = img._re.getResolutionLevels() - <span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">1</span></p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
zxyt = tile.split(<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">","</span>)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span>#w = int(zxyt[3])</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span>#h = int(zxyt[4])</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
level = levels-int(zxyt[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">0</span>])</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
x = int(zxyt[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">1</span>])*w</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
y = int(zxyt[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">2</span>])*h</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">except</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> logger.debug(</span>"render_image_region_quality: tile=%s"<span data-mce-style="color: #000000;" style="" class=""> % tile)</span></p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
logger.debug(traceback.format_exc())</p>
<div style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="webkit-block-placeholder">
</div><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">elif</span> region:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">try</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
xywh = region.split(<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">","</span>)</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
x = int(xywh[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">0</span>])</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
y = int(xywh[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">1</span>])</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
w = int(xywh[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">2</span>])</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
h = int(xywh[<span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">3</span>])</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">except</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> logger.debug(</span>"render_image_region_quality: region=%s"<span data-mce-style="color: #000000;" style="" class=""> % region)</span></p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
logger.debug(traceback.format_exc())</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #000000;" style="" class=""> </span># region details and quality in request are used as key for caching.</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
jpeg_data = webgateway_cache.getImage(request, server_id, img, z, t, ctx=q)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
jpeg_quality = float(q) / <span data-mce-style="color: #941100;" style="color: rgb(148, 17, 0);" class="">100.0</span></p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">if</span> jpeg_data <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">is</span> <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">"""</span></p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
jpeg_data_orig = img.renderJpegRegion(z,t,x,y,w,h,level=level, compression=jpeg_quality)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
pillow_img = Image.open(StringIO(jpeg_data_orig))</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
pillow_img = pillow_img.convert(mode="L")</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
rv = StringIO()</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
pillow_img.save(rv, 'jpeg', quality=int(10))</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
jpeg_data = rv.getvalue()</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
"""</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
jpeg_data = img.renderJpegRegion(z,t,x,y,w,h,level=level, compression=jpeg_quality)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">if</span> jpeg_data <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">is</span> <span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">None</span>:</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">raise</span> Http404</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
webgateway_cache.setImage(request, server_id, img, z, t, jpeg_data, ctx=q)</p><p style="margin: 10px 0px 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<br class="">
</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
rsp = HttpResponse(jpeg_data, content_type=<span data-mce-style="color: #00b400;" style="color: rgb(0, 180, 0);" class="">'image/jpeg'</span>)</p><p style="margin: 10px 0px 0px 30px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255);" class="">
<span data-mce-style="color: #0433ff;" style="color: rgb(4, 51, 255);" class="">return</span> rsp</p>
</div>
<div class=""><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class=""><br class="">
</em></div>
<div class=""><em style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; line-height: 20px;" class=""><br class="">
</em></div>
</div>
</div>
_______________________________________________ ome-devel mailing list <a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="">
ome-devel@lists.openmicroscopy.org.uk</a> <a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel" class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a> </span><br class="">
<span style="font-size:10pt;" class="">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</div>
_______________________________________________<br class="">ome-devel mailing list<br class=""><a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="">ome-devel@lists.openmicroscopy.org.uk</a><br class="">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<br class=""></div></blockquote></div><br class=""></div></div></body></html>