Last active
March 18, 2025 18:54
-
-
Save manzt/e630685b8da513d1a829fa3a1fa58c41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.13" | |
# dependencies = [ | |
# "ngff-zarr", | |
# "numpy", | |
# "rich", | |
# ] | |
# | |
# [tool.uv] | |
# exclude-newer = "2025-03-18T14:10:36.371318-04:00" | |
# /// | |
import ngff_zarr as nz | |
import numpy as np | |
import rich | |
def main() -> None: | |
source = np.random.randint( | |
low=0, high=2**16, size=(2, 300, 300, 300), dtype=np.uint16 | |
) | |
image = nz.to_ngff_image(source, dims=("c", "z", "y", "x")) | |
multiscales = nz.to_multiscales(image, scale_factors=2, chunks=(1, 32, 32, 32)) | |
rich.print(multiscales) | |
nz.to_ngff_zarr("data.ome.zarr", multiscales, version="0.5") | |
rich.print("done.") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment