diff --git a/ome2024-ngff-challenge/src/App.svelte b/ome2024-ngff-challenge/src/App.svelte index efc7169..f5f2dde 100644 --- a/ome2024-ngff-challenge/src/App.svelte +++ b/ome2024-ngff-challenge/src/App.svelte @@ -359,6 +359,22 @@ {sortedBy} {sortAscending} /> + +
+ +

Showing {tableRows.length} images

- +
@@ -537,5 +553,6 @@ border: solid var(--border-color) 1px; border-radius: 5px; width: fit-content; + margin: 5px 0; } diff --git a/ome2024-ngff-challenge/src/ImageList.svelte b/ome2024-ngff-challenge/src/ImageList.svelte index c7c11b3..edb303d 100644 --- a/ome2024-ngff-challenge/src/ImageList.svelte +++ b/ome2024-ngff-challenge/src/ImageList.svelte @@ -4,6 +4,7 @@ export let tableRows; export let textFilter; + export let sortedBy = undefined; function getItemKey(index) { return tableRows[index].url; @@ -46,7 +47,7 @@ on:afterScroll={afterScroll} >
- +
diff --git a/ome2024-ngff-challenge/src/ZarrListItem.svelte b/ome2024-ngff-challenge/src/ZarrListItem.svelte index f169ef6..af31831 100644 --- a/ome2024-ngff-challenge/src/ZarrListItem.svelte +++ b/ome2024-ngff-challenge/src/ZarrListItem.svelte @@ -7,6 +7,7 @@ export let rowData; export let textFilter; + export let sortedBy = undefined; let imgAttrs; let imgUrl; @@ -64,7 +65,13 @@ {dim.toUpperCase()}{rowData[`size_${dim}`]} {/if} {/each} - Size{filesizeformat(rowData.written)} + {#if sortedBy == "chunk_pixels" } + Chunks{rowData.chunks} + {:else if sortedBy == "shard_pixels" } + Shards{rowData.shards} + {:else} + Size{filesizeformat(rowData.written)} + {/if}
{@html rowData.name ? rowData.name.replaceAll(textFilter, `${textFilter}`) : ""}
diff --git a/ome2024-ngff-challenge/src/tableStore.js b/ome2024-ngff-challenge/src/tableStore.js index 418e1d0..02c4c85 100644 --- a/ome2024-ngff-challenge/src/tableStore.js +++ b/ome2024-ngff-challenge/src/tableStore.js @@ -157,6 +157,14 @@ class NgffTable { 0, ); } + if (row.chunks) { + let chunks = row.chunks.split(",").map((dim) => parseInt(dim)); + row.chunk_pixels = chunks.reduce((prev, curr) => prev * curr, 1); + } + if (row.shards) { + let shards = row.shards.split(",").map((dim) => parseInt(dim)); + row.shard_pixels = shards.reduce((prev, curr) => prev * curr, 1); + } row.rating = Math.random() * 4; return row; });