-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from will-moore/bioformats_layout
Since this has been announced now (see image.sc link above) this needs to be "released". Merging... (any fixes needed can come in follow-up PRs)
- Loading branch information
Showing
19 changed files
with
274 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<script> | ||
import { getXmlDom, getSchema, getJson, validate } from "../utils"; | ||
import JsonBrowser from "../JsonBrowser/index.svelte"; | ||
import ImageContainer from "../JsonValidator/Well/ImageContainer.svelte"; | ||
import vizarrLogoUrl from "../assets/vizarr_logo.png" | ||
export let source; | ||
export let rootAttrs; | ||
const metadataName = "OME/METADATA.ome.xml"; | ||
// source/OME/METADATA.ome.xml | ||
const metadataUrl = `${source}${metadataName}`; | ||
async function loadXml(url) { | ||
let dom = await getXmlDom(url); | ||
const root = dom.documentElement; | ||
let rsp = { images: [] }; | ||
for (const child of root.children) { | ||
console.log(child.tagName); | ||
if (child.tagName === "Image") { | ||
rsp.images.push({ | ||
name: child.getAttribute("Name"), | ||
id: child.getAttribute("ID"), | ||
}); | ||
} | ||
// error handling - parsererror gives html doc | ||
if (child.tagName === "body") { | ||
if (child.firstElementChild.tagName == "parsererror") { | ||
rsp.errors = [...child.firstElementChild.children].map( | ||
(el) => el.innerHTML | ||
); | ||
} | ||
} | ||
} | ||
return rsp; | ||
} | ||
const promise = loadXml(metadataUrl); | ||
// wait for schema to be cached, so we don't load them multiple times | ||
// let schemasPromise = getSchema("0.2", "image"); | ||
async function preloadSchema(imagePath) { | ||
let imgAttrs = await getJson(imagePath + "/.zattrs"); | ||
console.log("preloadSchema", imgAttrs); | ||
let errs = await validate(imgAttrs); | ||
return errs; | ||
} | ||
const dirs = source.split("/").filter(Boolean); | ||
const zarrName = dirs[dirs.length - 1]; | ||
const url = window.location.origin + window.location.pathname; | ||
</script> | ||
|
||
<article> | ||
Reading: <a href={source}>{zarrName}/.zattrs</a> | ||
|
||
<div class="json"> | ||
<JsonBrowser name="" version="" contents={rootAttrs} expanded /> | ||
</div> | ||
|
||
Loading metadata:<a href={metadataUrl}>{metadataName}</a><br /> | ||
|
||
{#await promise} | ||
<div>loading {metadataUrl}...</div> | ||
{:then metadataJson} | ||
<!-- Show list of Images --> | ||
<h1>Images</h1> | ||
<ol> | ||
{#await preloadSchema(source + "0")} | ||
<div>loading schema...</div> | ||
{:then ok} | ||
<ul> | ||
{#each metadataJson.images as image, i} | ||
<li class="image"> | ||
/{i} | ||
<a title="Open Image" href="{url}?source={source}{i}/" | ||
>{image.name}</a | ||
> | ||
|
||
<ImageContainer {source} path={i} /> | ||
|
||
<a title="View image in vizarr" class="vizarr_link" target="_blank" | ||
href="https://hms-dbmi.github.io/vizarr/?source={source}{i}/" | ||
><img src={vizarrLogoUrl}/></a> | ||
</li> | ||
{/each} | ||
</ul> | ||
{:catch error} | ||
<p style="color: red">{error.message}</p> | ||
{/await} | ||
</ol> | ||
|
||
<!-- Error handling... --> | ||
{#if metadataJson.errors} | ||
<div class="error"> | ||
<h2>Error parsing {metadataName}</h2> | ||
{#each metadataJson.errors as err, i} | ||
<div>{err}</div> | ||
{/each} | ||
</div> | ||
{/if} | ||
{:catch error} | ||
<p style="color: red">{error.message}</p> | ||
{/await} | ||
</article> | ||
|
||
<style> | ||
h1 { | ||
margin-top: 20px; | ||
} | ||
a, | ||
a:visited { | ||
color: #ff512f; | ||
} | ||
.vizarr_link { | ||
float: right; | ||
} | ||
.vizarr_link img { | ||
height: 24px; | ||
margin: 0; | ||
} | ||
.json { | ||
text-align: left; | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
color: #faebd7; | ||
background-color: #263749; | ||
padding: 10px; | ||
font-size: 14px; | ||
border-radius: 10px; | ||
font-family: monospace; | ||
} | ||
.image { | ||
list-style: none; | ||
text-align: left; | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
color: #faebd7; | ||
background-color: #263749; | ||
padding: 10px; | ||
font-size: 14px; | ||
border-radius: 10px; | ||
font-family: monospace; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/ZarrArray.svelte → ...r/MultiscaleArrays/ZarrArray/index.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/MultiscaleArrays.svelte → ...onValidator/MultiscaleArrays/index.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/PlateWell.svelte → ...ator/Plate/WellContainer/PlateWell.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/WellContainer.svelte → ...alidator/Plate/WellContainer/index.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.