Skip to content

Commit

Permalink
Add plate data to table, show total written bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Sep 6, 2024
1 parent 18ed84f commit 0c1142e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
17 changes: 15 additions & 2 deletions ome2024-ngff-challenge/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,31 @@

<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th colspan="2">Bytes written</th>
</tr>
<tr>
<th>Url</th>
<th>Bytes written</th>
<th>Shape</th>
<th>Wells</th>
<th>Images</th>
<th>per Image</th>
<th>total</th>
</tr>
</thead>
<tbody>
{#each tableRows as row}
<tr>
<td><a href="https://deploy-preview-36--ome-ngff-validator.netlify.app/?source={row.url}" target="_blank">{linkText(row.url)}</a></td>
<td>{filesizeformat(row.written)}</td>
<td>{row.shape || ""}</td>
<td>{row.well_count || ""}</td>
<td>{row.well_count ? row.well_count * row.field_count : ""}</td>
<td>{filesizeformat(row.written)}</td>
<td>{filesizeformat(row.written * (row.well_count ? row.well_count * row.field_count : 1))}</td>
</tr>
{/each}
</tbody>
Expand Down
17 changes: 11 additions & 6 deletions ome2024-ngff-challenge/src/tableStore.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { writable, get } from "svelte/store";

async function loadMultiscales(url) {
console.log("LOADING MULTISCALES", url);
let zarrData = await fetch(`${url}/zarr.json`).then((response) =>
response.json(),
);
Expand All @@ -10,15 +9,14 @@ async function loadMultiscales(url) {
if (!attributes) {
return undefined;
}
console.log("attributes", attributes);
if (attributes.multiscales) {
return [attributes.multiscales, url];
} else if (attributes.plate) {
let well = attributes.plate.wells[0];
// assume the first image in the well is under "/0"
let imgPath = `${url}/${well.path}/0`;
console.log("well", well, imgPath);
return await loadMultiscales(imgPath);
let [msData, msUrl] = await loadMultiscales(imgPath);
return [msData, msUrl, attributes.plate];
} else if (attributes["bioformats2raw.layout"]) {
let bf2rawUrl = `${url}/0`;
return await loadMultiscales(bf2rawUrl);
Expand Down Expand Up @@ -55,9 +53,15 @@ class NgffTable {
}

async loadNgffMetadata(zarrUrl) {
const [multiscales, msUrl] = await loadMultiscales(zarrUrl);
const [multiscales, msUrl, plate] = await loadMultiscales(zarrUrl);
let shape = [];
let written = 0;
let well_count = 0;
let field_count = 0;
if (plate) {
well_count = plate.wells.length;
field_count = plate.field_count || 1;
}
if (multiscales) {
// only consider the first multiscale and load highest resolution dataset
const dataset = multiscales[0]?.datasets[0];
Expand All @@ -73,7 +77,8 @@ class NgffTable {
console.log("No multiscales found");
return;
}
this.populateRow(zarrUrl, { shape, written });
// The data that is added to the Table
this.populateRow(zarrUrl, { shape, written, well_count, field_count });
}

subscribe(run) {
Expand Down

0 comments on commit 0c1142e

Please sign in to comment.