Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bioformats2raw layout #149

Open
will-moore opened this issue May 10, 2022 · 11 comments
Open

Support bioformats2raw layout #149

will-moore opened this issue May 10, 2022 · 11 comments

Comments

@will-moore
Copy link
Collaborator

Bioformats2raw exports a "Fileset" of 1 or more Images for some formats, as described at ome/ngff#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 #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

@joshmoore
Copy link

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

@manzt
Copy link
Member

manzt commented Jun 2, 2022

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.

@joshmoore
Copy link

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.

@will-moore
Copy link
Collaborator Author

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?

@manzt
Copy link
Member

manzt commented Jun 21, 2022

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.

@joshmoore
Copy link

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
Copy link

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?

@will-moore
Copy link
Collaborator Author

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

@joshmoore
Copy link

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.

@manzt
Copy link
Member

manzt commented Oct 20, 2022

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

@joshmoore
Copy link

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 ..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants