Kitware / itk-vtk-viewer

2D / 3D web image, mesh, and point set viewer using itk-wasm and vtk.js
https://kitware.github.io/itk-vtk-viewer/
BSD 3-Clause "New" or "Revised" License
210 stars 64 forks source link

feat(ngff zarr): add multi channel support #480

Closed PaulHax closed 2 years ago

PaulHax commented 2 years ago

Somehow these hacks work for all the datasets I've loaded except for the 2 lowest resolution scales in oeway's astronaut where the chunks span components.

thewtex commented 2 years ago

const chunkSize = toDimensionArray(['c', 'x', 'y', 'z'], info.chunkSize)

Instead of ['c', 'x', 'y', 'z'], this should be info.dims now, correct?

PaulHax commented 2 years ago

Works on oeway's astronaut now. Some fishy stuff with the x chunk index to shift down x rows:

pixelArray[
                cc +
                  zz * pixelStrides.z +
                  (yy + x) * pixelStrides.y +
                  xx * pixelStrides.x
              ] =
oeway commented 2 years ago

Thanks for working on this! Looking forward it! FYI: I am currently making a browser file system that can handle large files backed by indexeddb. Would be nice to test using pyodide/jupyterlite + zarr-python to read in-browser large files, then pipe the data as a zarr store to itk-vtk-viewer!

thewtex commented 2 years ago

Looking good. Can we base and add tests for the new datasets?

PaulHax commented 2 years ago

Looking good. Can we base and add tests for the new datasets?

Added tests for a selection of the working images.

Some issues:

thewtex commented 2 years ago

For the first two, we should fix the data generator. Could you please create issues on the multi-scale-spatial-image repository, and assign it to me?

For the endianness issue, we should transform an chunk array from big to little before loading into the itk.Image. Could you please look for a JS library to do that and apply when required?

PaulHax commented 2 years ago

[ ] 2. For the conditions where we can use them in the inner-most loop, use .subarray and .set for getting and setting the contiguous region.

Implemented the above with guidance from the old code. Good speedup with first_instar_brain_zyxc.zarr highest resolution taking the worker ~11ms vs old way of ~26ms.

oeway commented 2 years ago

Hi @PaulHax @thewtex Awesome to see this PR get merged! Well done, can't wait to try it.

It looks like the master branch CI is failing and that it explains why I cannot already show the multi-channel zarr images.

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 12.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

thewtex commented 2 years ago

Hi @oeway CI was given some :heart: , v12.3.0 is now out with these improvements, please give it a whirl!