Skip to content

Commit 69b2f60

Browse files
committed
Add Zarr info on homepage and show Zarr studies at the top
1 parent b6ead1e commit 69b2f60

3 files changed

Lines changed: 61 additions & 13 deletions

File tree

idr_gallery/static/idr_gallery/categories.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,23 @@ function render() {
115115
let idrIds = [];
116116

117117
let html = "";
118+
let zarrHtml = "";
118119
if (!groupByType) {
119-
// Show all studies...
120-
html = model.studies
121-
.map((study) => {
122-
let idrId = study.Name.split("-")[0];
123-
// Ignore multiple projects/screens from same study/publication
124-
if (idrIds.includes(idrId)) {
125-
return "";
126-
}
127-
idrIds.push(idrId);
128-
return studyHtml(study, studyContainers[idrId]);
129-
})
130-
.join("");
120+
// Show all studies... with 'zarr' stuides in a different section at the top
121+
zarrHtml = `<div style="color:#666; margin-bottom: 5px">OME-Zarr studies</div>`;
122+
model.studies.forEach((study) => {
123+
let idrId = study.Name.split("-")[0];
124+
// Ignore multiple projects/screens from same study/publication
125+
if (idrIds.includes(idrId)) {
126+
return "";
127+
}
128+
idrIds.push(idrId);
129+
if (study.zarr) {
130+
zarrHtml += studyHtml(study, studyContainers[idrId]);
131+
} else {
132+
html += studyHtml(study, studyContainers[idrId]);
133+
}
134+
});
131135
} else {
132136
// group by Categories
133137
let categories = Object.keys(CATEGORY_QUERIES);
@@ -179,6 +183,7 @@ function render() {
179183
}
180184

181185
document.getElementById("studies").innerHTML = html;
186+
document.getElementById("zarrStudies").innerHTML = zarrHtml;
182187

183188
// tooltips - NB: updated when thumbnails loaded
184189
tippy(".studyThumb", {

idr_gallery/static/idr_gallery/model.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ class StudiesModel {
302302
// Load Map Annotations
303303
await this.loadStudiesMapAnnotations();
304304

305+
// Load OME-NGFF tag and add 'zarr' attribute to studies with this tag
306+
await this.loadZarrTag();
307+
305308
// Generate StudyDescription (removes 'Publication Title' etc from project.Description)
306309
this.studies.forEach((study) => {
307310
study["StudyTitle"] = this.getStudyTitle(study);
@@ -332,6 +335,34 @@ class StudiesModel {
332335
}
333336
}
334337

338+
async loadZarrTag() {
339+
// Load OME-NGFF tag and add 'zarr' attribute to studies with this tag.
340+
// First load all tags to find the "OME-NGFF" tag and its ID
341+
let url = this.base_url + "webclient/api/tags/?orphaned=true&experimenter_id=-1&page=0";
342+
let tagJson = await fetch(url).then((response) => response.json());
343+
console.log("Found tags", tagJson);
344+
let ngffTag = tagJson["tags"].find((tag) => tag.value.includes("OME-NGFF"));
345+
if (!ngffTag) {
346+
console.warn("No OME-NGFF tag found");
347+
return;
348+
}
349+
let ngffTagId = ngffTag.id;
350+
url = this.base_url + `webclient/api/tags/?id=${ngffTagId}`;
351+
let zarrStudies = await fetch(url).then((response) => response.json());
352+
let zarrStudyIds = new Set(); // set of 'screen-123' or 'project-456' that have the OME-NGFF tag
353+
zarrStudies.screens.forEach((screen) => zarrStudyIds.add(`screen-${screen.id}`));
354+
zarrStudies.projects.forEach((project) => zarrStudyIds.add(`project-${project.id}`));
355+
console.log("zarrStudyIds", zarrStudyIds);
356+
// add "zarr" attribute to studies with this tag...
357+
this.studies = this.studies.map((study) => {
358+
if (zarrStudyIds.has(study.objId)) {
359+
console.log("Study with OME-NGFF tag:", study.objId);
360+
study.zarr = true;
361+
}
362+
return study;
363+
});
364+
}
365+
335366
async loadStudiesMapAnnotations() {
336367
let url = this.base_url + "webclient/api/annotations/?type=map";
337368
let data = this.studies

idr_gallery/templates/idr_gallery/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,19 @@ <h2 class="hero-subheader small-10 medium-10 large-10 small-offset-1 medium-offs
464464
<div class="row horizontal" style="position: relative">
465465
<div class="small-12 medium-12 large-12 columns">
466466
<div class="panel" style="float: left">
467-
<form>
467+
<div id="zarrInfo" style="margin-bottom: 10px; color: #333">
468+
<h3 style="color: white; padding: 15px; background: red;">Moving to OME-Zarr</h3>
469+
<p>
470+
The IDR is transitioning to the <a href="https://ngff.openmicroscopy.org/" target="_blank">OME-Zarr</a>
471+
format for improved data accessibility and performance. Images in other formats can no longer be viewed on-line
472+
in the IDR. We are working to convert all studies to OME-Zarr, but in the meantime non-Zarr images can be download for local viewing.
473+
All new studies must be submitted in OME-Zarr format.
474+
</p>
475+
</div>
476+
<div id="zarrStudies" style="margin-bottom: 15px">
477+
</div>
478+
<div style="clear:both; padding: 7px"></div>
479+
<form style="clear:both">
468480
<label class="switchLabel">Group Studies by type</label>
469481
<label class="switch" style="margin-right: 20px">
470482
<input id="groupByType" type="checkbox">

0 commit comments

Comments
 (0)