A Bioio reader plugin for reading czi images.
Project description
bioio-czi
A BioIO reader plugin for reading CZIs using pylibczirw (default) or aicspylibczi.
Documentation
See the bioio documentation on our GitHub pages site - the general use and installation instructions there will work for this package.
Information about the base reader this package relies on can be found in the bioio-base repository here.
This plugin attempts to follow the latest specification for the CZI file format from Carl Zeiss Microscopy (currently v1.2).
Installation
Install bioio-czi alongside bioio:
pip install bioio bioio-czi
Stable Release: pip install bioio-czi
Development Head: pip install git+https://github.com/bioio-devs/bioio-czi.git
pylibczirw vs. aicspylibczi
bioio-czi can operate in pylibczirw mode (the default) or aicspylibczi mode.
| Feature | pylibczirw mode | aicspylibczi mode |
|---|---|---|
| Read CZIs from the internet | ✅ | ❌ |
| Read single tile from tiled CZI | ❌ | ✅ |
| Read single tile's metadata from tiled CZI | ❌ | ✅ |
| Read elapsed time metadata* | ❌ | ✅ |
| Handle CZIs with different dimensions per scene** | ❌ | ✅ |
| Read stitched mosaic of a tiled CZI | ✅ | ✅ |
The primary difference is that pylibczirw supports reading CZIs over the internet but cannot access individual tiles from a tiled CZI. To use aicspylibczi, add the use_aicspylibczi=True parameter when creating a reader. For example: from bioio import BioImage; img = BioImage(..., use_aicspylibczi=True).
*Elapsed time metadata include the following. These are derived from individual subblock metadata.
BioImage(...).time_intervalBioImage(...).standard_metadata.timelapse_intervalBioImage(...).standard_metadata.total_time_duration
**The underlying pylibczirw reader only exposes per-scene X and Y dimensions. Files that do not have consistent dimensions per scene may be read incorrectly in pylibczirw mode.
Example Usage (see full documentation for more examples)
Basic usage
from bioio import BioImage
path = (
"https://allencell.s3.amazonaws.com/aics/hipsc_12x_overview_image_dataset/"
"stitchedwelloverviewimagepath/05080558_3500003720_10X_20191220_D3.czi"
)
img = BioImage(path)
print(img.shape) # (1, 1, 1, 5684, 5925)
Note: accessing files from the internet is not available in aicspylibczi mode.
Individual tiles with aicspylibczi
img = BioImage(
"S=2_4x2_T=2=Z=3_CH=2.czi",
reconstruct_mosaic=False,
include_subblock_metadata=True,
use_aicspylibczi=True
)
print(img.dims) # <Dimensions [M: 8, T: 2, C: 2, Z: 3, Y: 256, X: 256]>
subblocks = img.metadata.findall("./Subblocks/Subblock")
print(len(subblocks)) # 192
print(img.get_image_data("TCZYX", M=3).shape) # (2, 2, 3, 256, 256)
The M dimension is used to select a specific tile.
Stitched mosaic with pylibczirw
img = BioImage("S=2_4x2_T=2=Z=3_CH=2.czi")
print(img.dims) # <Dimensions [T: 2, C: 2, Z: 3, Y: 487, X: 947]>
All 8 tiles are stitched together. Where tiles overlap, the pixel value is the pixel value from the tile with the highest M-index.
Explicit Reader
This example shows a simple use case for just accessing the pixel data of the image
by explicitly passing this Reader into the BioImage. Passing the Reader into
the BioImage instance is optional as bioio will automatically detect installed
plug-ins and auto-select the most recently installed plug-in that supports the file
passed in.
from bioio import BioImage
import bioio_czi
img = BioImage("my_file.czi", reader=bioio_czi.Reader)
img.data
Issues
Click here to view all open issues in bioio-devs organization at once or check this repository's issue tab.
Development
See CONTRIBUTING.md for information related to developing the code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bioio_czi-2.6.0.tar.gz.
File metadata
- Download URL: bioio_czi-2.6.0.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39221a5fea2a14dcf89bdc899dc375c758ee5c34fae5b2db297e557c6165f0cc
|
|
| MD5 |
9f17898588d9ab98efade7275fd3e425
|
|
| BLAKE2b-256 |
c4d33731c63a52e612a027bb34e0578c431f95641e45c31150f3a6f0e6226d87
|
Provenance
The following attestation bundles were made for bioio_czi-2.6.0.tar.gz:
Publisher:
ci.yml on bioio-devs/bioio-czi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioio_czi-2.6.0.tar.gz -
Subject digest:
39221a5fea2a14dcf89bdc899dc375c758ee5c34fae5b2db297e557c6165f0cc - Sigstore transparency entry: 955357347
- Sigstore integration time:
-
Permalink:
bioio-devs/bioio-czi@6729f6dec012d3da7cda1caa520aee7272d2e5b6 -
Branch / Tag:
refs/tags/v2.6.0 - Owner: https://github.com/bioio-devs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@6729f6dec012d3da7cda1caa520aee7272d2e5b6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bioio_czi-2.6.0-py3-none-any.whl.
File metadata
- Download URL: bioio_czi-2.6.0-py3-none-any.whl
- Upload date:
- Size: 2.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d08308d3ab11a294198ccd5bdcd77695ed6a0e913776d6b796567a2ebd96669
|
|
| MD5 |
f77548ab1dbfff1f229094c226552ffe
|
|
| BLAKE2b-256 |
c818de94b265f161d874c500dee2e90b6fe4f341db1da098aa9a9a484a86fa34
|
Provenance
The following attestation bundles were made for bioio_czi-2.6.0-py3-none-any.whl:
Publisher:
ci.yml on bioio-devs/bioio-czi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioio_czi-2.6.0-py3-none-any.whl -
Subject digest:
0d08308d3ab11a294198ccd5bdcd77695ed6a0e913776d6b796567a2ebd96669 - Sigstore transparency entry: 955357386
- Sigstore integration time:
-
Permalink:
bioio-devs/bioio-czi@6729f6dec012d3da7cda1caa520aee7272d2e5b6 -
Branch / Tag:
refs/tags/v2.6.0 - Owner: https://github.com/bioio-devs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@6729f6dec012d3da7cda1caa520aee7272d2e5b6 -
Trigger Event:
push
-
Statement type: