diff --git a/omeroweb/webclient/templates/webclient/annotations/metadata_preview.html b/omeroweb/webclient/templates/webclient/annotations/metadata_preview.html index 5c1d9364f0..bb1238539c 100644 --- a/omeroweb/webclient/templates/webclient/annotations/metadata_preview.html +++ b/omeroweb/webclient/templates/webclient/annotations/metadata_preview.html @@ -118,7 +118,7 @@ {% if share and not share.share.isOwned %} OME.preview_viewport = $.WeblitzViewport($("#viewport"), "{% url 'webindex' %}{{ share.share.id }}", {'mediaroot': '{{ STATIC_URL }}' } ); {% else %} - OME.preview_viewport = $.WeblitzViewport($("#viewport"), "{% url 'webindex' %}", {'mediaroot': '{{ STATIC_URL }}' } ); + OME.preview_viewport = $.WeblitzViewport($("#viewport"), '{{ base_url }}', {'mediaroot': '{{ STATIC_URL }}' } ); {% endif %} OME.preview_viewport.bind('imageLoad', _refresh_cb); diff --git a/omeroweb/webclient/views.py b/omeroweb/webclient/views.py index 2435222042..4e47536694 100755 --- a/omeroweb/webclient/views.py +++ b/omeroweb/webclient/views.py @@ -1792,9 +1792,9 @@ def load_metadata_preview(request, c_type, c_id, conn=None, share_id=None, **kwa if c["active"]: act = "" color = c["lut"] if "lut" in c else c["color"] - reverse = "r" if c["inverted"] else "-r" + inverted = "r" if c["inverted"] else "-r" chs.append( - "%s%s|%s:%s%s$%s" % (act, i + 1, c["start"], c["end"], reverse, color) + "%s%s|%s:%s%s$%s" % (act, i + 1, c["start"], c["end"], inverted, color) ) rdefQueries.append( { @@ -1808,7 +1808,20 @@ def load_metadata_preview(request, c_type, c_id, conn=None, share_id=None, **kwa size_x = manager.image.getSizeX() size_y = manager.image.getSizeY() - context["tiledImage"] = (size_x * size_y) > (max_w * max_h) + base_url = reverse('webindex') + big_image = (size_x * size_y) > (max_w * max_h) + if not big_image: + # if we have omero_web_zarr installed and s3 data is available, we + # use that as data source for viewer via /zarr/render_image etc. + try: + from omero_web_zarr.views import get_zarr_s3_path + zarr_path = get_zarr_s3_path(conn, manager.image.id) + if zarr_path is not None and zarr_path.startswith("http"): + base_url = reverse('omero_web_zarr_index') + except ImportError: + pass + context["base_url"] = base_url + context["tiledImage"] = big_image context["manager"] = manager context["rdefsJson"] = json.dumps(rdefQueries) context["rdefs"] = rdefs