micro-reader-codecs 0.0.1__cp311-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- micro_reader_codecs/__init__.py +5 -0
- micro_reader_codecs/micro_reader_codecs.pyd +0 -0
- micro_reader_codecs-0.0.1.dist-info/METADATA +104 -0
- micro_reader_codecs-0.0.1.dist-info/RECORD +8 -0
- micro_reader_codecs-0.0.1.dist-info/WHEEL +4 -0
- micro_reader_codecs-0.0.1.dist-info/licenses/LICENSE +21 -0
- micro_reader_codecs-0.0.1.dist-info/licenses/THIRD_PARTY_LICENSES.txt +2933 -0
- micro_reader_codecs-0.0.1.dist-info/sboms/micro-reader-codecs.cyclonedx.json +2760 -0
|
Binary file
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: micro-reader-codecs
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Rust
|
|
8
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: THIRD_PARTY_LICENSES.txt
|
|
11
|
+
Summary: Native (Rust) image decoders for micro-reader: zstd, LZ4, LZW, deflate, PackBits, JPEG (incl. lossless), JPEG 2000, JPEG XL, PNG, WebP, packed bits, EER.
|
|
12
|
+
Keywords: microscopy,codecs,zstd,lz4,lzw,deflate,jpeg,jpeg2000,jpegxl,png,webp,eer
|
|
13
|
+
Author-email: Bugra Oezdemir <bugraa.ozdemir@gmail.com>
|
|
14
|
+
License-Expression: MIT
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
|
+
Project-URL: Homepage, https://github.com/bugraoezdemir/micro-reader
|
|
18
|
+
Project-URL: Issues, https://github.com/bugraoezdemir/micro-reader/issues
|
|
19
|
+
Project-URL: Source, https://github.com/bugraoezdemir/micro-reader
|
|
20
|
+
|
|
21
|
+
# micro-reader-codecs
|
|
22
|
+
|
|
23
|
+
**Native image decoders for [micro-reader](https://github.com/bugraoezdemir/micro-reader).**
|
|
24
|
+
|
|
25
|
+
`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.
|
|
26
|
+
|
|
27
|
+
You normally don't need to install it yourself. It is installed automatically with:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install micro-reader
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
It has no Python dependencies.
|
|
34
|
+
|
|
35
|
+
## How it works
|
|
36
|
+
|
|
37
|
+
* Every decoder writes straight into a buffer you provide, such as a NumPy array.
|
|
38
|
+
* Decoders run without holding Python's lock, so micro-reader's thread pool can decode on all cores.
|
|
39
|
+
* 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.
|
|
40
|
+
|
|
41
|
+
## Decoders
|
|
42
|
+
|
|
43
|
+
| Function | Codec | Rust crate |
|
|
44
|
+
| --------------------------- | ----------------------------------------- | ------------------------------------- |
|
|
45
|
+
| `zstd_decompress_into` | zstd | `zstd` (libzstd) |
|
|
46
|
+
| `lz4_block_decompress_into` | LZ4 block | `lz4_flex` |
|
|
47
|
+
| `lzw_decode_into` | LZW, TIFF variant | `weezl` |
|
|
48
|
+
| `zlib_decompress_into` | zlib / deflate | `libdeflater` (libdeflate) |
|
|
49
|
+
| `packbits_decode_into` | PackBits | own |
|
|
50
|
+
| `jpeg_decode_into` | JPEG: baseline, progressive and lossless | `jpeg-decoder` |
|
|
51
|
+
| `jxl_decode_into` | JPEG XL | `jxl-oxide` |
|
|
52
|
+
| `jpeg2k_decode_into` | JPEG 2000 (J2K, JP2) | `jpeg2k` (OpenJPEG) |
|
|
53
|
+
| `png_decode_into` | PNG | `png` |
|
|
54
|
+
| `webp_decode_into` | WebP, lossless and lossy | `image-webp` |
|
|
55
|
+
| `unpack_bits_into` | packed samples, 1 to 32 bit | own |
|
|
56
|
+
| `eer_decode_into` | EER (Falcon cryo-EM movies) | own, ported from imagecodecs (BSD-3) |
|
|
57
|
+
|
|
58
|
+
## Reading large blocks in parts
|
|
59
|
+
|
|
60
|
+
Some compressed blocks are too large to decode as a whole. These decoders read only part of a block:
|
|
61
|
+
|
|
62
|
+
* `jpeg2k_decode_area_into` and `jxl_decode_area_into` decode only the rectangle you ask for.
|
|
63
|
+
* `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.
|
|
64
|
+
* `BlockIndex` keeps checkpoints of a deflate block. Several `StreamDecoder`s can share one, so jumping back in the block resumes from the nearest checkpoint instead of the start.
|
|
65
|
+
|
|
66
|
+
## Not included yet
|
|
67
|
+
|
|
68
|
+
JPEG XR is not included, because the `jpegxr` crate needs libclang to build. Until then, micro-reader decodes JPEG XR through imagecodecs:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install "micro-reader[codecs]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Building
|
|
75
|
+
|
|
76
|
+
The Rust toolchain is pinned in `rust-toolchain.toml`. To build and install into the active virtual environment:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
maturin develop --release
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Tests
|
|
83
|
+
|
|
84
|
+
The tests live in the repository's `tests/` folder:
|
|
85
|
+
|
|
86
|
+
* `test_codecs.py`
|
|
87
|
+
* `test_czi_codecs.py`
|
|
88
|
+
* `test_tiff_codecs.py`
|
|
89
|
+
* `test_memory_limit.py`
|
|
90
|
+
|
|
91
|
+
They compare these decoders with independent reference decoders, bit for bit.
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
|
96
|
+
|
|
97
|
+
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`.
|
|
98
|
+
|
|
99
|
+
Whenever `Cargo.lock` changes, regenerate it with:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
python scripts/third_party_licenses.py
|
|
103
|
+
```
|
|
104
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
micro_reader_codecs/__init__.py,sha256=DbojxqF9gNqbxTYYOB_IYFok8tY0imPftFmzLuIzIQA,159
|
|
2
|
+
micro_reader_codecs/micro_reader_codecs.pyd,sha256=FLKlcLkMfr8yHxayJjvqSKoWuChrice6m1XH81xnluo,3573760
|
|
3
|
+
micro_reader_codecs-0.0.1.dist-info/METADATA,sha256=DYGIChdbGdtGgqFYEFeMtnzOBBMnk6qkBQsKyP0wbQ8,5091
|
|
4
|
+
micro_reader_codecs-0.0.1.dist-info/WHEEL,sha256=I37eTNpE2wbBLxuGAyG7p6lFvJQiIjnLN05rBA0wN9g,96
|
|
5
|
+
micro_reader_codecs-0.0.1.dist-info/licenses/LICENSE,sha256=4uiM0CqEtfNkBUieqjpB1XmOoRdx9iXosmiRgvS3Xdg,1092
|
|
6
|
+
micro_reader_codecs-0.0.1.dist-info/licenses/THIRD_PARTY_LICENSES.txt,sha256=qdgp2qP6DthR45lSNO-gjnOnp-NfthnkSbxbquF7ocw,148715
|
|
7
|
+
micro_reader_codecs-0.0.1.dist-info/sboms/micro-reader-codecs.cyclonedx.json,sha256=S-Dz1F9W0_sVVietfRmNx7LCnKW0V04j7xtH1clMn1k,88793
|
|
8
|
+
micro_reader_codecs-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bugra Oezdemir
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|