Nifti-Zarr conversion tools in Python
Project description
Example implementation of the nifti-zarr specification in Python
Installation
pip install nifti-zarr
Python API
Convert a nifti file to a nifti-zarr storage.
from niizarr import nii2zarr
nii2zarr("path/to/nifti.nii.gz", "s3://path/to/bucket")
Convert a nifti-zarr storage to a nifti file.
The pyramid level can be selected with level=L, where 0 is the base/finest level.
from niizarr import zarr2nii
zarr2nii("s3://path/to/bucket", "path/to/nifti.nii.gz", level=0)
Load a nifti-zarr into a nibabel.Nifti1Image object.
from niizarr import zarr2nii
nivol = zarr2nii("s3://path/to/bucket", level=0)
Command Line Interface
NIfTI to NIfTI-Zarr
usage: nii2zarr [-h]
[--chunk CHUNK]
[--unchunk-channels]
[--unchunk-time]
[--levels LEVELS]
[--method {gaussian,laplacian}]
[--fill FILL]
[--compressor {blosc,zlib}]
[--label]
[--no-label]
[--no-time]
[--no-pyramid-axis {x,y,z}]
[--zarr-version {2,3}]
[--ome-version {0.4,0.5}]
input [output]
Convert nifti to nifti-zarr.
positional arguments:
input Input nifti file.
output Output zarr directory.
When not specified, write to input directory.
optional arguments:
-h, --help Show this help message and exit.
--chunk CHUNK Spatial chunk size.
--unchunk-channels Save all chanels in a single chunk.
Unchunk if you want to display all channels
as a single RGB layer in neuroglancer.
Chunked by default, unless datatype is RGB.
--unchunk-time Save all timepoints in a single chunk.
Unchunk if you want to display all timepoints
as a single RGB layer in neuroglancer.
Chunked by default.
--levels LEVELS Number of levels in the pyramid.
If -1 (default), use as many levels as possible.
--method {gaussian,laplacian} Pyramid method.
--fill FILL Missing value.
--compressor {blosc,zlib} Compressor.
--label Segmentation volume.
--no-label Not a segmentation volume.
--no-time No time dimension.
--no-pyramid-axis {x,y,z} Thick slice axis that should not be downsampled.
--zarr-version {2,3} Zarr format version.
--ome-version {0.4,0.5} OME-Zarr specification version.
NIfTI-Zarr to NIfTI
usage: zarr2nii [-h] [--level LEVEL] input [output]
Convert nifti-zarr to nifti.
positional arguments:
input Input zarr directory
output Output nifti file.
When not provided, write to the same directory as input
optional arguments:
-h, --help Show this help message and exit.
--level LEVEL Pyramid level to extract (default: 0 = finest).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nifti_zarr-1.0.0rc3.tar.gz.
File metadata
- Download URL: nifti_zarr-1.0.0rc3.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
608235f0476366bd84afdda87ba31e82671378251266025cf813f43519ff7dc0
|
|
| MD5 |
482ca18f4b5eb356fc7b647367fdaa06
|
|
| BLAKE2b-256 |
97f3812809fac41a9dfcccda6ddcad4c382f006b5e65f9bbbb763e60a6e182d2
|
Provenance
The following attestation bundles were made for nifti_zarr-1.0.0rc3.tar.gz:
Publisher:
publish_on_release.yml on neuroscales/nifti-zarr-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nifti_zarr-1.0.0rc3.tar.gz -
Subject digest:
608235f0476366bd84afdda87ba31e82671378251266025cf813f43519ff7dc0 - Sigstore transparency entry: 192550542
- Sigstore integration time:
-
Permalink:
neuroscales/nifti-zarr-py@659088bfcedb275cdb51d7373c04e59be2e209d0 -
Branch / Tag:
refs/tags/1.0.0rc3 - Owner: https://github.com/neuroscales
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_on_release.yml@659088bfcedb275cdb51d7373c04e59be2e209d0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nifti_zarr-1.0.0rc3-py3-none-any.whl.
File metadata
- Download URL: nifti_zarr-1.0.0rc3-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66372416c6a09b885afd447edb9d5b285690e41bca10b5e2e2b94335db431bca
|
|
| MD5 |
e3b48ddfb61f7ea18b808406bc4f4db7
|
|
| BLAKE2b-256 |
6ca44329a6d392d0b252072091bf46e31f4796fe89c21dde2581b4639f0e0b5e
|
Provenance
The following attestation bundles were made for nifti_zarr-1.0.0rc3-py3-none-any.whl:
Publisher:
publish_on_release.yml on neuroscales/nifti-zarr-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nifti_zarr-1.0.0rc3-py3-none-any.whl -
Subject digest:
66372416c6a09b885afd447edb9d5b285690e41bca10b5e2e2b94335db431bca - Sigstore transparency entry: 192550544
- Sigstore integration time:
-
Permalink:
neuroscales/nifti-zarr-py@659088bfcedb275cdb51d7373c04e59be2e209d0 -
Branch / Tag:
refs/tags/1.0.0rc3 - Owner: https://github.com/neuroscales
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_on_release.yml@659088bfcedb275cdb51d7373c04e59be2e209d0 -
Trigger Event:
release
-
Statement type: