Anscombe transform
This codec is designed for compressing image recordings with Poisson noise, which are produced by photon-limited modalities such multiphoton microscopy, radiography, and astronomy.
The codec assumes that the video is linearly encoded with a potential offset (zero_level) and that the photon_sensitivity (the average increase in intensity per photon) is either already known or can be accurately estimated from the data.
The codec re-quantizes the grayscale efficiently with a square-root-like transformation to equalize the noise variance across the grayscale levels: the Anscombe Transform. This results in a smaller number of unique grayscale levels and significant improvements in the compressibility of the data without sacrificing signal accuracy.
To use the codec, one must supply two pieces of information: zero_level (the input value corresponding to the absence of light) and photon_sensitivity (levels/photon).
The codec is used in Zarr as a filter prior to compression.
Zarr.
Installation
Install via pip:
pip install anscombe-transform
Development Setup
Getting Started
- Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/anscombe-transform.git
cd anscombe-transform
- Install Hatch
Via pip:
pip install hatch
Or directly.
- Create a development environment
# See available environments
hatch env show
# Enter a test environment
hatch shell test.py3.11-2.2
Install pre-commit
- Run tests
# Run all tests
hatch run test:pytest tests/
# Run specific test file
hatch run test:pytest tests/test_codec.py
# Run with coverage
hatch run test:pytest tests/ --cov=src/anscombe_transform
Testing
The project uses pytest for testing. Tests are found in the tests/ directory.
Building Documentation
Local Documentation Server
# Install docs dependencies
hatch run docs:mkdocs serve
# View at http://127.0.0.1:8000
Building Documentation
# Build static site
hatch run docs:mkdocs build
# Output in site/
Getting Help
- Questions? Open a GitHub Discussion
- Bug reports? Open an Issue
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Release files for anscombe-transform 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anscombe_transform-1.0.0.tar.gz | 19.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anscombe_transform-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 MB
Release files / anscombe_transform-1.0.0.tar.gz
| Download URL | anscombe_transform-1.0.0.tar.gz |
|---|---|
| Size | 19.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0624897aa2ab98b545181778de53936a6b7a60b111b3f1b945d39b27714c39b2
|
|
BLAKE2b-256 checksum How to use checksums |
260c6b644a460c60cc8accf424bd8e70d7c5882cc64511c275e2aaca7b1b32c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / anscombe_transform-1.0.0-py3-none-any.whl
| Download URL | anscombe_transform-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5eaf4c1bc15c2d62f2771aee2f20a0493059759f8794c6673c9c70c83207621a
|
|
BLAKE2b-256 checksum How to use checksums |
1010e3e702702dde1f5a511a8df9b8beb8dbbd82b3ac4a9935effa4ce2182fe1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|