ZarrNii is a Python library for working with OME-Zarr and NIfTI formats. ZarrNii bridges the gap between these two popular formats, enabling seamless data transformation, metadata preservation, and efficient processing. The motivating application is for whole brain lightsheet microscopy and ultra-high field MRI, but it can generally be used for any 3T+channel datasets.
Install zarrnii using pip:
pip install zarrnii
Or install the latest development version from GitHub:
pip install git+https://github.com/khanlab/zarrnii.git
from zarrnii import ZarrNii
# Load an OME-Zarr dataset
znimg = ZarrNii.from_ome_zarr("path/to/zarr_dataset.ome.zarr")
# Perform a transformation (e.g., downsample)
downsampled_znimg = znimg.downsample(level=2)
# Save as NIfTI
downsampled_znimg.to_nifti("output_dataset.nii")
ZarrNii allows you to:
Full Documentation: here