From 621637d83a2f633662cacbd1c027411f45ef5a0b Mon Sep 17 00:00:00 2001 From: William Moore Date: Thu, 9 Feb 2023 17:51:39 +0000 Subject: [PATCH] Add support for plates --- index.html | 2 +- public/favicon-16x16.png | Bin 0 -> 753 bytes public/zarr_samples.json | 1 + src/App.jsx | 3 +++ src/ImageItem.jsx | 28 +++++++++++++++++++++++----- 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 public/favicon-16x16.png diff --git a/index.html b/index.html index 881eb1a..8ff82c4 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + React + OME Zarr Catalog
diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..d894595a9a13bf5649835ca6ce2a80070e421393 GIT binary patch literal 753 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>32_C|GG6UMZJAQx zjUtu#vR>`?G#u`0*x%Ezm+d_(>(wR`F-^99A5aZM8Biq}Th^^puqz!+9B2X%J1!ru=CT=||85(}dB~vQgjrX4HDAzm+k$nAlZ&j*i!Z+W`6X-YZL>}{hE2Ea8%}&O z|1@!u$?10rt`)55p}P8Ab0)k`?qB}GYNBuR!a1v^I!$qY5<7oM=+tk&x!Ep>T)QT) zX+O}dswJ)wB`Jv|saDBFsX&Us$iT=@*U(7U&^*M@z{=Rr%Gg-jz`)ADK&9X>Fg+k? z$jwj5OsmALAyn7Z0;nOpDkP#LD6w3jpeR2rGbdG{q_QAYA+w+)nSr5V&f`x!9ED*T z8mIhEpYePe#K5e~t(VL#tSsz3S%g_w!KK0Ea0;{X<`9L`H?EvGa^{H45%$v!9t*tm Z7+#4BmV9zDoeH#q!PC{xWt~$(69Djs0g(Uz literal 0 HcmV?d00001 diff --git a/public/zarr_samples.json b/public/zarr_samples.json index ae265ce..9b8a466 100644 --- a/public/zarr_samples.json +++ b/public/zarr_samples.json @@ -1,5 +1,6 @@ { "urls": [ + "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0001A/2551.zarr", "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0048A/9846152.zarr", "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.3/9836842.zarr", "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.2/6001240.zarr", diff --git a/src/App.jsx b/src/App.jsx index bf70695..7309724 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -23,6 +23,9 @@ export default function App() { sizeC sizeT Axes + Wells + Fields + keywords {items} diff --git a/src/ImageItem.jsx b/src/ImageItem.jsx index 0812269..da40f03 100644 --- a/src/ImageItem.jsx +++ b/src/ImageItem.jsx @@ -17,21 +17,33 @@ export default function ImageItem({ source }) { let attrs = await node.attrs.asObject(); console.log("attrs", attrs); + let keywords = []; + let wells; + let fields; + + // Check if we have a plate or bioformats2raw.layout... + let redirectSource; if (attrs.plate) { - return; + fields = attrs.plate.field_count; + wells = attrs.plate.wells.length; + let wellPath = source + "/" + attrs.plate.wells[0].path; + let wellJson = await fetch(wellPath + "/.zattrs").then(rsp => rsp.json()); + redirectSource = wellPath + "/" + wellJson.well.images[0].path; } else if (attrs['bioformats2raw.layout']) { // Use the first image at /0 - source = source + "/0"; - config = {source} + redirectSource = source + "/0"; + } + if (redirectSource) { + // reload with new source + config = {source: redirectSource} node = await open(config.source); attrs = await node.attrs.asObject(); - console.log("attrs", attrs); + keywords.push("bioformats2raw.layout"); } const axes = getNgffAxes(attrs.multiscales); let layerData = await loadOmeroMultiscales(config, node, attrs); - console.log("layerData", layerData); let shape = layerData.loader[0]._data.meta.shape; @@ -57,6 +69,9 @@ export default function ImageItem({ source }) { dims: dims, axes: axes.map((axis) => axis.name).join(""), version: attrs.multiscales?.[0]?.version, + keywords, + wells, + fields }); }; @@ -81,6 +96,9 @@ export default function ImageItem({ source }) { {sizes} {imgInfo.axes} + {imgInfo.wells} + {imgInfo.fields} + {imgInfo?.keywords?.join(", ")}