flatironinstitute / neurosift

Browser-based NWB visualization and DANDI exploration
Apache License 2.0
39 stars 4 forks source link

Volumetric 2P broken? #156

Closed CodyCBakerPhD closed 2 months ago

CodyCBakerPhD commented 2 months ago

https://neurosift.app/?p=/nwb&url=https://api.dandiarchive.org/api/assets/8477f3df-2feb-4da8-bb82-364f58a3a8ec/download/&dandisetId=000350&dandisetVersion=0.221219.1506&tab=neurodata-item:/acquisition/TwoPhotonSeries|TwoPhotonSeries

should show a whole brain zebrafish, but something seems quite off

Any ideas @magland?

magland commented 2 months ago

@CodyCBakerPhD This has now been fixed.

However, you will notice that it is slow to load every new frame. That's because it needs to load all the planes for every frame. The chunking should allow a much more efficient loading (see below), but neurosift does not right now have the ability to slice in this complex way. I guess that should be submitted as a separate issue.

In [1]: import lindi
   ...: 
   ...: url = 'https://lindi.neurosift.org/dandi/dandisets/000350/assets/8477f3df-2feb-4da8-bb82-364f58a3a8ec/zarr.json'
   ...: 
   ...: # Load the remote file
   ...: f = lindi.LindiH5pyFile.from_reference_file_system(url)
   ...: 
   ...: # load the neurodata object
   ...: X = f['/acquisition/TwoPhotonSeries']

In [2]: X
Out[2]: <LindiH5pyGroup: /acquisition/TwoPhotonSeries>

In [3]: X['data']
Out[3]: <LindiH5pyDataset: /acquisition/TwoPhotonSeries/data>

In [4]: X['data'].shape
Out[4]: (10050, 888, 2048, 30)

In [5]: X['data'].chunks
Out[5]: (1, 888, 2048, 1)
CodyCBakerPhD commented 2 months ago

Looks great, thanks