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

Add support for NIfTI-Zarr file type in neuroglancer #50

Open
MikeSchutzman opened this issue Apr 3, 2024 · 3 comments
Open

Add support for NIfTI-Zarr file type in neuroglancer #50

MikeSchutzman opened this issue Apr 3, 2024 · 3 comments

Comments

@MikeSchutzman
Copy link

No description provided.

@MikeSchutzman MikeSchutzman changed the title Description of the NIfTI-Zarr spec for integration in neuroglancer Add support for NIfTI-Zarr file type in neuroglancer Apr 3, 2024
@balbasty
Copy link

Thanks Michael, I am adding a small description here.

Nifti is the standard format for MRI data in neuroimaging research. It is a simple binary format made of a short binary header followed by the raster data stored in Fortran order (that is, "x" is the fastest dimension). Importantly, it stores a spatial transform that allows the data to be displayed in a well defined coordinte space where:

  • the "x" axis correspond to the left-to-right anatomical axis
  • the "y" axis corresponds to the posterior-to-anterior anatomical axis
  • the "z" axis corresponds to the inferior-to-superior anatomical axis.

The binary file is generally further gzipped for lossless compression. As a single file format, nifti is not adapted to very large volumes, nor does it allow efficient random access to its voxels.

On the other hand, Zarr, and it microscopy-specific child OME-Zarr split very large arrays across many small chunks that are individually compressed. OME-Zarr further support storing the same volume at multiple dimensions, thereby enabling fast multi-resolution visualization. However, the current specification does not support spatial coordinate transforms, appart from canonical scales and translations.

We've proposed Nifti-Zarr as a lightwait addition to OME-Zarr that stores the binary nifti header within an OME-Zarr directory, thereby supporting the same kind of spatial transforms widely embraced by the neuroimaging community.

Neuroglancer is a web-based viewer for large remote files that supports both OME-Zarr and nifti files. This project aims to add support for the Nifti-Zarr format. This new reader will reuse routines from the Nifti and Zarr readers already present in neuroglancer and apply the correct nifti transform to the zarr array.

@balbasty
Copy link

I have uploaded two nifti-zarr files to dandi. They can be accessed and loaded into neuroglancer with these URLs:

  1. This is a link to a neuroglancer visualization that does not know about the nifti metadata
  2. This is a link to a neuroglancer visualization that does know about the nifti metadata

You can see in the second link that:

  • "x" points towards the anatomical right of the brain (right)
  • "y" points towards the front of the brain (anterior)
  • "z" points towards the top of the brain (superior)

The second visualization is currently achieved by modifying the layer's transform in the neuroglancer state, but we would like to achieve this natively by loading the file with a niftizarr:// protocol.

@MikeSchutzman

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

2 participants