From 6acb5e3561e451c4c022fb47543f21e29d2ed8a9 Mon Sep 17 00:00:00 2001 From: William Moore Date: Tue, 4 Feb 2025 10:24:13 +0000 Subject: [PATCH 1/2] getVersion() returns version.split('-')[0] --- src/utils.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/utils.js b/src/utils.js index d352d6d..0bc0f6b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -139,34 +139,40 @@ export async function getSchema(schemaUrl) { export function getVersion(ngffData) { // if we have attributes.ome then this is version 0.5+ + let version; if (ngffData.attributes?.ome) { if (ngffData.attributes.ome.version) { - return ngffData.attributes.ome.version; + version = ngffData.attributes.ome.version; } else { throw Error("No version found in attributes.ome"); } } // Used if we have our 'attributes' at the root - if (ngffData.ome?.version) { - return ngffData.ome.version; + else if (ngffData.ome?.version) { + version = ngffData.ome.version; } - if (ngffData.version) { - return ngffData.version; + else if (ngffData.version) { + version = ngffData.version; } // Handle version 0.4 and earlier - let version = ngffData.multiscales - ? ngffData.multiscales[0].version - : ngffData.plate - ? ngffData.plate.version - : ngffData.well - ? ngffData.well.version - : undefined; + else { + version = ngffData.multiscales + ? ngffData.multiscales[0].version + : ngffData.plate + ? ngffData.plate.version + : ngffData.well + ? ngffData.well.version + : undefined; + } console.log("version", version); // for 0.4 and earlier, version wasn't MUST and we defaulted // to using v0.4 for validation. To preserve that behaviour // return "0.4" if no version found. - return version || "0.4"; + version = version || "0.4"; + + // remove any -dev2 etc. + return version.split("-")[0]; } export function toTitleCase(text) { From aca5e1bbf5187cbadb7d5b4984b988f4dba9fb0c Mon Sep 17 00:00:00 2001 From: William Moore Date: Tue, 4 Feb 2025 10:26:12 +0000 Subject: [PATCH 2/2] Fix handling of version in multiscale panels --- src/JsonValidator/MultiscaleArrays/Multiscale.svelte | 3 ++- src/JsonValidator/MultiscaleArrays/index.svelte | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/JsonValidator/MultiscaleArrays/Multiscale.svelte b/src/JsonValidator/MultiscaleArrays/Multiscale.svelte index b13d6af..fc049d8 100644 --- a/src/JsonValidator/MultiscaleArrays/Multiscale.svelte +++ b/src/JsonValidator/MultiscaleArrays/Multiscale.svelte @@ -4,6 +4,7 @@ export let source; export let multiscale; + export let version; const WARNING = "warning"; @@ -11,7 +12,7 @@ // shape.length (number of dimensions) // If multiscale.axes (version > 0.3) check it matches shape - const { axes, datasets, version } = multiscale; + const { axes, datasets } = multiscale; const permitDtypeMismatch = ["0.1", "0.2", "0.3", "0.4"].includes(version); const checkDimSeparator = ["0.2", "0.3", "0.4"].includes(version); diff --git a/src/JsonValidator/MultiscaleArrays/index.svelte b/src/JsonValidator/MultiscaleArrays/index.svelte index d654097..727ee0a 100644 --- a/src/JsonValidator/MultiscaleArrays/index.svelte +++ b/src/JsonValidator/MultiscaleArrays/index.svelte @@ -13,7 +13,7 @@ {#each rootAttrs.multiscales as multiscale, idx}

Multiscale {idx}

- + {#each multiscale.datasets as dataset} {/each}