-
Notifications
You must be signed in to change notification settings - Fork 35
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
Will moore/ome zarr #816
Will moore/ome zarr #816
Conversation
Thanks, I just made a new PR into your branch with some comments here will-moore#1 I am not super familiar with the OME-Zarr format but maybe @ilan-gold or @manzt can also take a look after the holiday break |
As far as moving this type of code into viv or vizarr, there was some discussion here hms-dbmi/viv#290 and I think the conclusion is that making the Viv loader instances is fairly application-specific and should be easy to implement, so the implementation started in this PR is perfectly fine |
@will-moore In terms of addressing hardcoding/props for rendering, the vitessce/src/schemas/config.schema.json Lines 192 to 254 in 03de209
Then you likely have to alter this function (or the ones it calls) in order to handle these pre-initialized render/channel settings coming from the loader (in contrast, currently the application gets these settings via a pre-configured view config like this or is auto-inferred using our stats functions for rendering/best guess for channel selections, not the source itself): vitessce/src/components/data-hooks.js Lines 336 to 387 in 03de209
Note that this function calls initializeRasterLayersAndChannels which I believe does auto-initalization so removing/altering that behavior is an essential feature here, I think. One option is probably to use initializeLayerChannelsIfMissing instead but I could be wrong. I'll try to look into this more in the coming days to be certain, but wanted to give some suggestions in case you feel inclined to start poking around.
The overarching machinery to handle the rendering settings being set from this location instead of a view configuration like the one you have in your gist should be in place otherwise. Sorry to put you in the deep end here in terms of developing in this repo since this is basically a new feature, but hopefully it's not too painful - we're always here to answer questions too or help out with the code when we can! I think @manzt is best positioned to discuss |
Minor tweaks to OME-Zarr PR
Copying the demos from the comments of the will-moore#1 PR: |
@manzt @will-moore Are you all aware of something with the padding on the tiles? It seems like they are padded, but the size of the zarr store does not report that. Am I missing something? |
Sorry just catching up.
I have some thoughts, but first it would be useful to define each of our tools:
We can think of Viv as a prop-driven toolkit for rendering biomedical images. However, this means that applications using Viv need to decide on how to manage the state of those props (e.g. I have opened an issue in Vizarr with a more detailed description, but I think the best approach to reduce duplicated code is to extract the ome-specific, creating zarr-arrays and parsing metadata, to a shared module. Vizarr can just use this package to derive it's initial state (like napari), and vitessce can translate that initial state into it's own (which is a subset of vizarr's).
Could you be any more specific? URL to a data source would be useful. What do you mean by padding? screenshot? |
There are a few demos linked above that I have checked out locally and noticed this odd behavior. I am not sure what is going on, but the returned tiles appear to be uniformly |
Every zarr chunk (tile) is the same shape, even if it is an edge chunk/tile. So yes, all chunks are "padded". |
Ok @manzt there must be something going on with Viv then. I'll extract the OME loading logic to there temporarily so I can debug. I thought this would have been handled by hms-dbmi/viv#308 but I must be wrong or missing something, as I often am :) |
The effect is just that Zarr tiles are always the same size, regardless of whether the dimensions of the base image are a multiple of the tile size. I don't think this should be an issue because it's ok that |
Just so I can learn more about the OME-Zarr metadata format - besides the code duplication and lack of usage of the
|
Yes, dimensions are always
OME-Zarr describes a hierarchical layout for many related images. I believe each OME-Zarr image implements the This might be useful for reference: https://ngff.openmicroscopy.org/latest/#image-layout "Each image is a Zarr group, or a folder, of other groups and arrays. Group level attributes are stored in the .zattrs file include "multiscales" and "omero" below." So as a client the trick is to read the
I don't believe so, and I think this a step in the right direction. I just wanted to offer some options for greater code reuse. |
Hi, thanks for all the discussion above. Just catching up... As far as this PR is concerned, I'd like to get the OmeZarrLoader to provide the rendering settings from the OME-Zarr file (if available) instead of using the defaults (as in Demo 1) or providing them in the url/config (as in Demo 2). But as mentioned above, adding this to the image layer I'm returning from the loader like this:
has no effect, presumably because it's being overwritten or just ignored. I haven't discussed any of this with the OME team yet cc @joshmoore - This was an idea I thought worth trying over the holidays but we're all back on Tuesday so will hopefully be able to give it a bit more focus then. @manzt Thanks for creating hms-dbmi/vizarr#69 - will give it some thought... |
Currently, we have these two pretty disconnected notions of:
This is an important feature that we should discuss more generally (i.e. how to initialize things in the coordination space upon loading a file). We currently have round-about ways to initialize visualization parameters on initial load if they are missing:
Probably not a coincidence that the code to do these initializations is some of the most confusing in the whole repo: I think instead, we could allow the
This should also have the benefit of fixing another bug: currently, the initializations are dependent on having certain components in the current layout (e.g. cell set colors cannot be initialized unless the |
For the moment. A loosening of the ordering is certainly in the works. Then it will be necessary to read metadata about the order in order to interpret the possibly-non-5D array appropriately.
"multiscales" is currently a MUST and there's no current proposal to change that. "omero" is non-standard and will be replaced by the rendering information itself. |
Apologies for letting this slide... |
@will-moore I made a PR into your branch to set the rendering settings, except the bounds for how far the sliders can go (i.e properly having Relatedly, how are the rendering settings calculated/set for these inages? I would be interested in mocking (or outright copying) the method if possible in the browser, if you'd be ok with that. What we do now seems to work well but I'd be fine copying what you do if that is feasible. |
When we import images into OMERO, it parses all the pixel data to find the minimum and maximum pixel values for each channel. These will be the limits of the sliders and also the initial start/end settings. This calculation can cost a lot of time, so for very large imports (e.g. IDR) we tend to skip this at import, so the min/max values aren't in OMERO and the sliders default to the full pixel range (e.g. http://idr.openmicroscopy.org/webclient/img_detail/9621401/). In this case we tend to manually set the initial rendering setting for a large number of images (e.g. whole plate) to the same value. When we do know min/max values our image viewers still allow the user to enter a start/end value that is outside the range of the slider (e.g. http://idr.openmicroscopy.org/webclient/img_detail/1884823/). This will "stretch" the range of the slider temporarily, until you slide a handle to a smaller range and it will return to it's original range. OMERO also tries to guess initial channel colours from the acquisition metadata. In particular, the wavelength or filters associated with each channel. I'm not sure where this logic is, although someone else on the team will be able to show us if you're interested? (will you have access to acquisition metadata in the browser?) |
@will-moore Right now Viv exposes (and Vitessce/Avivator use)
Is this part of the OMEXML metadata? If so, we certainly have that from |
@ilan-gold @will-moore |
@will-moore I am going to close this. We have implemented support of OME-Zarr provisionally via #849 with an outstanding issue #894. We cannot set the max/min directly yet of the sliders, although the actual setting of them, colors, etc. has been dealt with. Thanks for getting the ball rolling on this, and as a bonus it prompted a good discussion of what our limitations are and made the code base stronger. I'll let you know once it is released. |
Sounds great. Many thanks! |
See #815
This is initial work towards supporting OME-Zarr images.
Currently, I'm using a config file at https://gist.githubusercontent.com/will-moore/b48704fa803ad6ab977214c5e7cace24/raw/b4a317d19ebd45081ae0c512d4907b0d9dc57aca/omezarr.json
and this uses the new OmeZarrLoader to load a Zarr (https://hms-dbmi.github.io/vizarr/?source=https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/179706.zarr). Quite a lot of this is hard-coded for now: Only showing a single Z and single T dimensions.
To get this working, I've just copied some code from vizarr instead of using the
viv
createZarrLoader()
which expects a consolidated.zmetadata
file, which doesn't exist for OME-Zarr.I don't know if we want to have Vitessce depend on vizarr. Maybe see how much code is duplicated once I've cleaned this up a bit.
I'll try to reduce some of the hard-coding and try to get my head around more of this as I go...