vizarr icon indicating copy to clipboard operation
vizarr copied to clipboard

Support bioformats2raw layout

Open will-moore opened this issue 2 years ago • 11 comments

Bioformats2raw exports a "Fileset" of 1 or more Images for some formats, as described at https://github.com/ome/ngff/pull/112 with the paths to them as 0/, 1/, etc and names and other metadata in a top-level /OME/METADATRA.ome.xml.

Some sample data is available at https://minio-dev.openmicroscopy.org/idr/bf2raw/mdb/martin/sample_files.zarr (that dir contains a .zattrs with {"bioformats2raw.layout" : 3}) which is a set of 8 small images.

E.g. using that source and adding the following code snippet to io.ts, I was able to read the Image names...

code snippet
if ("bioformats2raw.layout" in attrs && attrs["bioformats2raw.layout"] == 3) {
    // const source_url = config.source;
    const source_url = `${ node.store.store.url }/${node.path}`;
    const xmlUrl = `${ source_url }/OME/METADATA.ome.xml`;
    fetch(xmlUrl)
    .then(response => response.text())
    .then(data => {
      const parser = new DOMParser();
      const doc = parser.parseFromString(data, "application/xml");
      const errorNode = doc.querySelector("parsererror");
      if (errorNode) {
        console.log("error while parsing");
      } else {
        console.log(doc.documentElement.nodeName);
        console.log(doc.querySelectorAll("Image").forEach(el => {
          console.log('image element', el, el.getAttribute("Name"));
        }));
      }
    })
    .catch(console.error);
  }

It would be nice to show the Thumbnails and Names (and other metadata?) for the images, and click them to open the Full Image in the viewer. I looked again at code I had for doing this with "Collections" at https://github.com/hms-dbmi/vizarr/pull/125 but can't get the Thumbnails (or Typescript) working now. Might need to try a different approach (and forget about the Thumbnails initially)...

cc @joshmoore @sbesson

will-moore avatar May 10 '22 10:05 will-moore

@ilan-gold @manzt: we are moving closer to a finalization of https://github.com/ome/ngff/pull/112 retroactively for NGFF 0.2-0.4. Do you foresee any blockers for implementing it?

joshmoore avatar May 31 '22 14:05 joshmoore

I suggested some changes in #125 to towards some of this behavior. I don't forsee many blockers implementation-wise, but my guess is the biggest challenge will be deciding on a UI. If understand correctly there is no JPEG/PNG thumbnail in the metadata, and this is something that we will need to generate on the client.

One idea is to load these thumbnails on demand (e.g., a table of image names that expands the row with a thumbnail rendering when clicked) to avoid loading all the data upfront. However, I think the most simple would be to just load all for the time being.

manzt avatar Jun 02 '22 16:06 manzt

If understand correctly there is no JPEG/PNG thumbnail in the metadata, and this is something that we will need to generate on the client.

Correct.

joshmoore avatar Jun 03 '22 08:06 joshmoore

Re: deciding on a UI... How do we want to go about that? @manzt do you want to sketch something out? I can update #125 to work with bioformats2raw layout, but I don't know if that's anything like the approach you want or if a fresh start would be preferable?

will-moore avatar Jun 08 '22 08:06 will-moore

Hi @will-moore thanks for you patience on this. I was on vacation all of last week and did not have my laptop with me.

My main concern is that Vizarr is primarily a standalone viewer, and I'm not entirely sure where this idea for a metadata/collection view fits into that framework.

On first approximation, it would seem more appropriate to me to have this feature in a separate webpage and then link out to vizarr as you described.

and click them to open the Full Image in the viewer.

I think a compromise would be to make vizarr a "multi-page" app with a separate "route" (e.g,. /fileset) for this UI. That way we could reuse all the dependencies / utilities in vizarr, but avoid overloading the 'root' / even further for something beyond the viewer functionality.

manzt avatar Jun 21 '22 16:06 manzt

A heads up that I'll be moving forward with merging the bioformats2raw.layout spec into the v0.4 version within the next week or so.

joshmoore avatar Jul 06 '22 09:07 joshmoore

Ok, so my time estimates were way off (such is life) but we would very much like to get the bioformat2raw.layout into the wild soon. Trevor, how would you like to handle this on the vizarr side? If you're still thinking standalone app, can we redirect users? Or show them an error message?

joshmoore avatar Sep 15 '22 09:09 joshmoore

Hopefully, https://github.com/ome/ome-ngff-validator/pull/13 can serve as the entry-point for bioformats2raw layout, now that we link out to vizarr for the child images.

will-moore avatar Sep 16 '22 10:09 will-moore

Definitely think it's a good entrypoint, but my biggest concern would be what do users who don't know about the other app (or don't realize that their S3 URI points to a collection with the new spec) learn what vizarr expects of them?

As a side note: IIUC, this brings us closer to the format used by Vitessce if that simplifies matters.

joshmoore avatar Sep 22 '22 07:09 joshmoore

I think that’s a totally valid concern. What do you think about adding some redirect or prompt if vizarr recognizes a collection?

manzt avatar Oct 20 '22 14:10 manzt

Either seems fine. For a redirect, we might want to add explanatory text on the validator page, "this dataset has multiple images. you can open either ..."

joshmoore avatar Oct 20 '22 23:10 joshmoore