Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview viewer uses omero-web-zarr s3 data if available #529

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 17 additions & 3 deletions omeroweb/webclient/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand All @@ -1808,7 +1808,21 @@ 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
Expand Down
Loading