hms-dbmi / vizarr

A minimal Zarr image viewer based on Viv.
https://hms-dbmi.github.io/vizarr/?source=https://minio-dev.openmicroscopy.org/idr/v0.3/idr0062-blin-nuclearsegmentation/6001240.zarr
MIT License
114 stars 16 forks source link

Display of HCS Plate not fully working #168

Closed r0f1 closed 1 year ago

r0f1 commented 1 year ago

Hi,

I have two PerkinElmer high-content screening plates that I separately converted with bioformats2raw to the .zarr format. One of them I can display without any issues, the other one has a problem.

The problem with the second plate is the following: I can display the overview page and see all the wells next to each other, but when I click on one of the wells, the site is black and not even the sidebar on the left is loaded. That means, displaying all fields of a single well does not work. However, when I enter the url of a single field, display works again.

Both plates can be displayed in napari and both plates are compliant when I run them through the ome-ngff validator tool.

So I have a hunch why display might not work and maybe you can confirm: The plate that I can display properly, contains some wells, fields, three z-planes and two timepoints. The plate that I cannot display properly contains also some wells and fields but only a single z-plane and a single timepoint. Looking at the multiscales key in the .zattrs JSON of one of the fields, I see that there are five axes (time, channel, z, y, x) for the plate that I cannot display properly, even though time and z-plane are always one.

Could it be that vizarr expects there to be more than one timepoint (or more than one z-plane) when the timepoint (or z) axis is available in the .zattrs file?

Best, Flo

will-moore commented 1 year ago

Single Z or T images should work just fine. If you use the browser dev-tools to show the Console, do you see any errors? Are all the fields in the Well the same size (shape)? That could be the issue, since I think vizarr expects that they are.

r0f1 commented 1 year ago

Thanks for the quick response. The fields have all the same dimensions, so that cannot be the reason. Here is a screenshot from the console in the new tab that opened once I clicked on one of the fields. image

will-moore commented 1 year ago

So I think the error is coming from this line: https://github.com/hms-dbmi/vizarr/blob/98e7e1e7d2fcab2c9a25751056b0f6cd1d9b0169/src/ome.ts#L73 where data[offset] is null.

How many fields are in the Well? It looks like the code might only work with a 'full' grid of fields. E.g. if you have 9 fields then it will calculate a grid of 3 x 3 and every row/column will be filled. If you have 6 fields then you will have a 3 x 2 grid and every row/column will be filled, e.g. https://hms-dbmi.github.io/vizarr/?source=https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0001A/2551.zarr/A/1

But if you have e.g. 5 fields then you will have a 3 x 2 grid but the last position will be empty.

r0f1 commented 1 year ago

It looks like the code might only work with a 'full' grid of fields.

Ahhh, yes that is the issue. When we image plates, we do not always image all possible fields (5x5 grid), but sometimes we use fewer fields (say only 8 fields) that are not necessarily in a rectangular grid and that are randomly dispersed within the well. (As a side note, the original location of the field in the well can be recoved by parsing the metadata in the Index.ref.xml).

I must say I am a little impressed that you could determine what my error was without me providing any sample data.

will-moore commented 1 year ago

If that was the problem, I'm hoping that the PR #169 will fix it. Can you try the preview build of the app at https://deploy-preview-169--vizarr.netlify.app/ with your data?

r0f1 commented 1 year ago

Yes, I just tried it and confirm that I can now click on a well and see all the fields in that well (even though the fields were not imaged in a rectangular grid).

Thank you!

will-moore commented 1 year ago

@r0f1 Now that PR's been merged, the fix should be in the vizarr app.