Skip to content

Commit 90d4897

Browse files
committed
Image landing page for zarr images gives links to validator and iviewer
1 parent 30c7bd8 commit 90d4897

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

idr_gallery/templates/idr_gallery/image.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,20 @@
3737
<h2>Image Name: {{ image.name }}</h2>
3838
<strong>ID: {{ image.id }}</strong><br />
3939
<strong>Study: {{ idr_study }}</strong>
40-
<p>
41-
This image is not viewable online. <br/>
42-
The IDR only supports the viewing of OME-Zarr images.
43-
</p>
40+
41+
{% if ext_info and ext_info.httpUrl %}
42+
<p>
43+
<!-- NB: IF we change to img_detail/ID/ to loading THIS page for zarrs, then we can't use it here (will always redirect back) -->
44+
<a href="{% url 'web_image_viewer' image.id %}">View in Web Image Viewer</a><br/>
45+
This image is available as an OME-Zarr file at the following URL:
46+
<a href="https://ome.github.io/ome-ngff-validator/?source={{ ext_info.httpUrl }}" target="_blank">{{ ext_info.httpUrl }}</a>
47+
</p>
48+
{% else %}
49+
<p>
50+
This image is not viewable online. <br/>
51+
The IDR only supports the viewing of OME-Zarr images hosted on S3.
52+
</p>
53+
{% endif %}
4454
</div>
4555
</div>
4656

idr_gallery/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,9 @@ def image_landing_page(request, iid, zarr_to_iviewer=False, conn=None, **kwargs)
552552
"entityId": ext_info.entityId,
553553
"id": ext_info.id,
554554
}
555+
if ext_info.lsid and ext_info.lsid.startswith("s3:"):
556+
# If ExternalInfo is an S3 URL, we can link to it directly from the landing page
557+
ext_info_json["httpUrl"] = ext_info.lsid.replace("s3:", "https:").replace("?anonymous=true", "")
555558

556559
# Image is archived and has no ExternalInfo - show other options...
557560
img_info = get_image_info(conn, image.id)

0 commit comments

Comments
 (0)