Skip to main content

micro-reader-codecs

Native image decoders for micro-reader.

micro-reader-codecs holds the Rust decoders that micro-reader uses to read compressed microscopy data. It is a separate package so that micro-reader itself stays pure Python.

You normally don't need to install it yourself. It is installed automatically with:

pip install micro-reader

It has no Python dependencies.

How it works

  • Every decoder writes straight into a buffer you provide, such as a NumPy array.
  • Decoders run without holding Python's lock, so micro-reader's thread pool can decode on all cores.
  • JPEG 2000 and JPEG XL decode on one thread each. micro-reader already decodes many tiles at once, and threads inside the codec would compete for the same cores.

Decoders

Function Codec Rust crate
zstd_decompress_into zstd zstd (libzstd)
lz4_block_decompress_into LZ4 block lz4_flex
lzw_decode_into LZW, TIFF variant weezl
zlib_decompress_into zlib / deflate libdeflater (libdeflate)
packbits_decode_into PackBits own
jpeg_decode_into JPEG: baseline, progressive and lossless jpeg-decoder
jxl_decode_into JPEG XL jxl-oxide
jpeg2k_decode_into JPEG 2000 (J2K, JP2) jpeg2k (OpenJPEG)
png_decode_into PNG png
webp_decode_into WebP, lossless and lossy image-webp
unpack_bits_into packed samples, 1 to 32 bit own
eer_decode_into EER (Falcon cryo-EM movies) own, ported from imagecodecs (BSD-3)

Reading large blocks in parts

Some compressed blocks are too large to decode as a whole. These decoders read only part of a block:

  • jpeg2k_decode_area_into and jxl_decode_area_into decode only the rectangle you ask for.
  • StreamDecoder decodes one compressed block of a file as a stream and keeps only the bytes you ask for. It supports zlib, deflate, LZW, zstd, PackBits, PNG rows and uncompressed data. Each read continues where the last one stopped.
  • BlockIndex keeps checkpoints of a deflate block. Several StreamDecoders can share one, so jumping back in the block resumes from the nearest checkpoint instead of the start.

Not included yet

JPEG XR is not included, because the jpegxr crate needs libclang to build. Until then, micro-reader decodes JPEG XR through imagecodecs:

pip install "micro-reader[codecs]"

Building

The Rust toolchain is pinned in rust-toolchain.toml. To build and install into the active virtual environment:

maturin develop --release

Tests

The tests live in the repository's tests/ folder:

  • test_codecs.py
  • test_czi_codecs.py
  • test_tiff_codecs.py
  • test_memory_limit.py

They compare these decoders with independent reference decoders, bit for bit.

License

MIT

The bundled crates and C libraries (libzstd, libdeflate, OpenJPEG) are MIT, Apache-2.0, BSD or Zlib licensed. Their notices ship in every wheel as THIRD_PARTY_LICENSES.txt.

Whenever Cargo.lock changes, regenerate it with:

python scripts/third_party_licenses.py

Metadata

Release files for micro-reader-codecs 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micro-reader-codecs 0.0.1
File Size Uploaded
micro_reader_codecs-0.0.1.tar.gz 47.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for micro-reader-codecs 0.0.1
File
micro_reader_codecs-0.0.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
micro_reader_codecs-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
micro_reader_codecs-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
micro_reader_codecs-0.0.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
micro_reader_codecs-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 8.5 MB

Release files / micro_reader_codecs-0.0.1.tar.gz

Download URL micro_reader_codecs-0.0.1.tar.gz
Size 47.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b307d47f66d93aa3af0e57f4a7f403499180e4d022ad7027994e898f2941bb9a
BLAKE2b-256 checksum
How to use checksums
7f278caa8837b874ec1269c16e215d155c87e4a3c45f9efd2b81710a52322f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / micro_reader_codecs-0.0.1-cp311-abi3-win_amd64.whl

Download URL micro_reader_codecs-0.0.1-cp311-abi3-win_amd64.whl
Size 1.6 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c836296c2cf7527184ca312add83dbffa22c5d5a4dc2b4d75190d8b0bc648a23
BLAKE2b-256 checksum
How to use checksums
10ca6c589909b70d61f60c43089df4d4ba631eadbf1ec4f2189d6e71185a4d3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / micro_reader_codecs-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL micro_reader_codecs-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.8 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8362610d0da8eb7a5b67c34b6ba9a893773208863e3c945ac00b6340446c9e0b
BLAKE2b-256 checksum
How to use checksums
7e9540115724614ab23f6c306509bc6dbb13a487bf1dff3e1e4cb54a72126e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / micro_reader_codecs-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL micro_reader_codecs-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
05ea6a175b07dbc103e60c66b241bb25892553e1b833a2da772edd2d53f5e763
BLAKE2b-256 checksum
How to use checksums
b73f09247f8e933c096549f8e4fea2f802175cac853c478022e2c276793a895f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / micro_reader_codecs-0.0.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL micro_reader_codecs-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4638e9711ec8c79bf88ccb547956be94b6981de752de0a947c6ff9275b5b0758
BLAKE2b-256 checksum
How to use checksums
b83fa98ae3d529e9fb3026877e17a368a2fe66186c078cad7e09ac670776d4af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / micro_reader_codecs-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL micro_reader_codecs-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.7 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6a950a8b2611b7ab10d32bd4aa0f59dcf26519f1ddfaa15931f48291e3e8da1e
BLAKE2b-256 checksum
How to use checksums
a3b9ec10b5d55e6f34c9adcf760cb553bd84a37a9450f5e85bf4bf4538a46f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page