Skip to main content

Performant streaming to Zarr storage, on filesystem or cloud

Project description

DOI

Acquire Zarr streaming library

Build Tests Chat

This library supports chunked, compressed, multiscale streaming to Zarr, with OME-NGFF metadata.

This code builds targets for python and C.

For python: pip install acquire-zarr

Building

Installing dependencies

This library has the following dependencies:

We use vcpkg to install them, as it integrates well with CMake. To install vcpkg, clone the repository and bootstrap it:

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh

and then add the vcpkg directory to your path. If you are using bash, you can do this by running the following snippet from the vcpkg/ directory:

cat >> ~/.bashrc <<EOF
export VCPKG_ROOT=${PWD}
export PATH=\$VCPKG_ROOT:\$PATH
EOF

If you're using Windows, learn how to set environment variables here. You will need to set both the VCPKG_ROOT and PATH variables in the system control panel.

Configuring

To build the library, you can use CMake:

cmake --preset=default -B /path/to/build /path/to/source

On Windows, you'll need to specify the target triplet to ensure that all dependencies are built as static libraries:

cmake --preset=default -B /path/to/build -DVCPKG_TARGET_TRIPLET=x64-windows-static /path/to/source

Aside from the usual CMake options, you can choose to disable tests by setting BUILD_TESTING to OFF:

cmake --preset=default -B /path/to/build -DBUILD_TESTING=OFF /path/to/source

To build the Python bindings, make sure pybind11 is installed. Then, you can set BUILD_PYTHON to ON:

cmake --preset=default -B /path/to/build -DBUILD_PYTHON=ON /path/to/source

Building

After configuring, you can build the library:

cmake --build /path/to/build

Installing for Python

To install the Python bindings, you can run:

pip install .

[!NOTE] It is highly recommended to use virtual environments for Python, e.g. using venv or conda. In this case, make sure pybind11 is installed in this environment, and that the environment is activated before installing the bindings.

Usage

The library provides two main interfaces. First, ZarrStream, representing an output stream to a Zarr dataset. Second, ZarrStreamSettings to configure a Zarr stream.

A typical use case for a 4-dimensional acquisition might look like this:

ZarrStreamSettings settings = (ZarrStreamSettings){
    .store_path = "my_stream.zarr",
    .data_type = ZarrDataType_uint16,
    .version = ZarrVersion_3,
};
settings.store_path = "my_stream.zarr";
settings.data_type = ZarrDataType_uint16;
settings.version = ZarrVersion_3;

ZarrStreamSettings_create_dimension_array(&settings, 4);
settings.dimensions[0] = (ZarrDimensionProperties){
    .name = "t",
    .type = ZarrDimensionType_Time,
    .array_size_px = 0,      // this is the append dimension
    .chunk_size_px = 100,    // 100 time points per chunk
    .shard_size_chunks = 10, // 10 chunks per shard
};

settings.dimensions[1] = (ZarrDimensionProperties){
    .name = "c",
    .type = ZarrDimensionType_Channel,
    .array_size_px = 3,     // 3 channels
    .chunk_size_px = 1,     // 1 channel per chunk
    .shard_size_chunks = 1, // 1 chunk per shard
};

settings.dimensions[2] = (ZarrDimensionProperties){
    .name = "y",
    .type = ZarrDimensionType_Space,
    .array_size_px = 1080,  // height
    .chunk_size_px = 270,   // 4 x 4 tiles of size 270 x 480
    .shard_size_chunks = 2, // 2 x 2 tiles per shard
};

settings.dimensions[3] = (ZarrDimensionProperties){
    .name = "x",
    .type = ZarrDimensionType_Space,
    .array_size_px = 1920,  // width
    .chunk_size_px = 480,   // 4 x 4 tiles of size 270 x 480
    .shard_size_chunks = 2, // 2 x 2 tiles per shard
};

ZarrStream* stream = ZarrStream_create(&settings);

size_t bytes_written;
ZarrStream_append(stream, my_frame_data, my_frame_size, &bytes_written);
assert(bytes_written == my_frame_size);

Look at acquire.zarr.h for more details.

This acquisition in Python would look like this:

import acquire_zarr as aqz
import numpy as np

settings = aqz.StreamSettings(
    store_path="my_stream.zarr",
    data_type=aqz.DataType.UINT16,
    version=aqz.ZarrVersion.V3
)

settings.dimensions.extend([
    aqz.Dimension(
        name="t",
        type=aqz.DimensionType.TIME,
        array_size_px=0,
        chunk_size_px=100,
        shard_size_chunks=10
    ),
    aqz.Dimension(
        name="c",
        type=aqz.DimensionType.CHANNEL,
        array_size_px=3,
        chunk_size_px=1,
        shard_size_chunks=1
    ),
    aqz.Dimension(
        name="y",
        type=aqz.DimensionType.SPACE,
        array_size_px=1080,
        chunk_size_px=270,
        shard_size_chunks=2
    ),
    aqz.Dimension(
        name="x",
        type=aqz.DimensionType.SPACE,
        array_size_px=1920,
        chunk_size_px=480,
        shard_size_chunks=2
    )
])

# Generate some random data: one time point, all channels, full frame
my_frame_data = np.random.randint(0, 2**16, (3, 1080, 1920), dtype=np.uint16)

stream = aqz.ZarrStream(settings)
stream.append(my_frame_data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acquire_zarr-0.2.2.tar.gz (60.3 kB view details)

Uploaded Source

Built Distributions

acquire_zarr-0.2.2-cp313-cp313-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.13 Windows x86-64

acquire_zarr-0.2.2-cp313-cp313-manylinux_2_35_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.35+ x86-64

acquire_zarr-0.2.2-cp313-cp313-macosx_14_0_universal2.whl (3.3 MB view details)

Uploaded CPython 3.13 macOS 14.0+ universal2 (ARM64, x86-64)

acquire_zarr-0.2.2-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

acquire_zarr-0.2.2-cp312-cp312-manylinux_2_35_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.35+ x86-64

acquire_zarr-0.2.2-cp312-cp312-macosx_14_0_universal2.whl (3.3 MB view details)

Uploaded CPython 3.12 macOS 14.0+ universal2 (ARM64, x86-64)

acquire_zarr-0.2.2-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

acquire_zarr-0.2.2-cp311-cp311-manylinux_2_35_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.35+ x86-64

acquire_zarr-0.2.2-cp311-cp311-macosx_14_0_universal2.whl (3.3 MB view details)

Uploaded CPython 3.11 macOS 14.0+ universal2 (ARM64, x86-64)

acquire_zarr-0.2.2-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

acquire_zarr-0.2.2-cp310-cp310-manylinux_2_35_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

acquire_zarr-0.2.2-cp310-cp310-macosx_14_0_universal2.whl (3.3 MB view details)

Uploaded CPython 3.10 macOS 14.0+ universal2 (ARM64, x86-64)

acquire_zarr-0.2.2-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

acquire_zarr-0.2.2-cp39-cp39-manylinux_2_35_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.35+ x86-64

acquire_zarr-0.2.2-cp39-cp39-macosx_14_0_universal2.whl (3.3 MB view details)

Uploaded CPython 3.9 macOS 14.0+ universal2 (ARM64, x86-64)

File details

Details for the file acquire_zarr-0.2.2.tar.gz.

File metadata

  • Download URL: acquire_zarr-0.2.2.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for acquire_zarr-0.2.2.tar.gz
Algorithm Hash digest
SHA256 442a198c49d59429869c8478a2c1c57af6aab9beacc6b361245cb937404abf26
MD5 d9551bee3e94d39e8e6303d8d717683d
BLAKE2b-256 186a346f66afae65b067363bd76f15c1709b5e13145027d8e9dc687e39edd5f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2.tar.gz:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c566fadbb9854cf9ef4861ba2290854ed1fb8fdeef0db365cc93d43a71ff9b83
MD5 f096f290301c779b0964037178452b3a
BLAKE2b-256 6e469325e953ea1b28a9f2e3ce2e161a1c1e442e11577b2bf78bf2a63bd5a4a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp313-cp313-win_amd64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 338474aa5a1ad3702f95910f9015a0d17d77f87655fdc86db4e191c5682195ae
MD5 0e426aa46fe3f6c9122f8e4176eedfeb
BLAKE2b-256 5a9ab22c24470b03be158c59234c71e707787d4e8a9015dcd9f7436e0d808b84

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp313-cp313-manylinux_2_35_x86_64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp313-cp313-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp313-cp313-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 b120eb80b3069c23e9b5af576e257a438eaea3bcdb3b4b99d63109952555bde8
MD5 7470f97378a20d4da3eb118852bda73f
BLAKE2b-256 119a2440b610dc61133a104d62f518248247e125d1d42fcd4a20641bd3bf66f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp313-cp313-macosx_14_0_universal2.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eb2824274f68278cd6651348abfa313fc3fd3af3624825db225956427f996dd3
MD5 4fc80b5928da7cc868e991d0f8e830db
BLAKE2b-256 5a346ca59e30593fb91a7c53c3f92bfae72943dd98faf3f57ed64f46ba9f3211

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp312-cp312-win_amd64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 4d1fd8983d237059df1f29571a8f30a30b77da66510031042860f815834df600
MD5 8bbc322b294f1cb115e9a4b3324884c7
BLAKE2b-256 686f1f38e3025eeb4905932faf458b5455c3fb5e8bce308130930d066a7e1c61

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp312-cp312-manylinux_2_35_x86_64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp312-cp312-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp312-cp312-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 a1881031cc824d3d46810b55efed5cb6403f6ed0b77f10af02b8fa6e15372fb0
MD5 4e3982ecf2bc9151d4b1ba12eb392510
BLAKE2b-256 eb17020917545727c84a4cdaa7360698496aa03a626c515551732171cba9dee0

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp312-cp312-macosx_14_0_universal2.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 365fac2c4143572e7426fae3beb42fe2577be24d9848af8cfbbb9e0a7248f54a
MD5 6c7a95090b90b663cc65172b287e12a3
BLAKE2b-256 482b34203cc0cb1b6d4c17fa7a3aa1aad08ab215e6c305d49b6a45295da2cf40

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp311-cp311-win_amd64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7589a26c34a738a5ddd571c22260f94e795cdfc501f9dc54d2936f62383fb2b2
MD5 793bddf86c927e6ed8e4e07dbbffddf5
BLAKE2b-256 60a0ff670bd257946707663534e032124549029ebc28ffeb89e9d847aefd5786

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp311-cp311-manylinux_2_35_x86_64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp311-cp311-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp311-cp311-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 fda3aff89b6496c00c7ffbc9c39de1592f068e0cd13b407935df9fa87fe4f276
MD5 a9115e1139c2354bf6d8a91736dc9cbb
BLAKE2b-256 31a6ce5dc898d1549db53b8a8be2bdb898f6033f9428ef33ba70b6a5fbfc2193

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp311-cp311-macosx_14_0_universal2.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3f8671909af1aaafac7cd937232c99c8a981dca101e4d9933a7fa69750f0d86a
MD5 8546e2d6a3ece873d6016a93876b3ce1
BLAKE2b-256 9cc90441972d70881e508f5dd7c3adfd52702230b98290e179671dc581cd8998

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp310-cp310-win_amd64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 76a69f7dda7a894cef0ae2adf0ec236b4b4cd173495741a2a06a49d716bf2f28
MD5 6652fbdf12228adcebd1bc874b35def6
BLAKE2b-256 1cbf5e596649a26c11ef2b581fa16356dce10857f080193f38fa972768f7100f

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp310-cp310-manylinux_2_35_x86_64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp310-cp310-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp310-cp310-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 5f7e78a65f3cc41e75be194320ddf634cdbec238b93c46e15dead4b227a72575
MD5 09dc4c7599c5741f8c1eaa01b3029b50
BLAKE2b-256 d8e38d1eae4c274df56986ce774f173571e1d64830f492c69982480448b9c286

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp310-cp310-macosx_14_0_universal2.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ce9b2293c3ef96680b55303a3e635ad69529ed46c0e45da28f3353619bd529a9
MD5 c4052bc56a2c212366f42fce953272fe
BLAKE2b-256 b150b25706772893f4f087b189f90f3f32afcf9201b54f96dbb971a530f687b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp39-cp39-win_amd64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 29b2b78dc52f48448a43da50e64d9e6128f6b3e3484f0b1f010a801341704aa9
MD5 187a0721900d77e35528401a9a0fff41
BLAKE2b-256 3fa083157d1ce4e4bf262a38ff92fea63edc697d7e8a172cf50701b262709f7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp39-cp39-manylinux_2_35_x86_64.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acquire_zarr-0.2.2-cp39-cp39-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for acquire_zarr-0.2.2-cp39-cp39-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 1d0adce0ddd498c49ceabe00ae17089512e8b13eefa17f2e70120ada67b38491
MD5 0bccc28d227167cc44256b65388b595c
BLAKE2b-256 1fc1be8526f04639e6e1084effc1a0d130112b63659ae2365addabdc7b998a7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for acquire_zarr-0.2.2-cp39-cp39-macosx_14_0_universal2.whl:

Publisher: release.yml on acquire-project/acquire-zarr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page