Skip to main content

czitools

PyPI PyPI - Downloads License codecov Python Version Development Status

This repository provides tools for reading CZI (Carl Zeiss Image) pixel data and metadata in Python, interpreting CZI well plates as an HCS Plate → Well → Field model, and converting CZI data to OME-Zarr. It is available as a Python package on PyPI.

For full documentation see sebi06.github.io/czitools.

Installation

Basic Installation

Install the core package from PyPI:

pip install czitools

Optional Features

Install with additional functionality using optional extras:

# OME-ZARR export (conversion + validation)
pip install "czitools[omezarr]"

# OME-ZARR export with GUI converter application
pip install "czitools[omezarr-gui]"

# HCS plate analysis and visualization
pip install "czitools[analysis]"

# Everything (all optional dependencies)
pip install "czitools[all]"

Development Installation

For development or to get the latest unreleased features:

# Clone the repository
git clone https://github.com/sebi06/czitools.git
cd czitools

# Install in editable mode with all extras
pip install -e ".[all]"

Conda/Pixi Development Environment

The cloned repository includes both a conda environment file and a Pixi workspace:

# Create the provided conda environment
conda env create -f env_czitools.yml
conda activate czitools

# Or install the locked Pixi workspace
pixi install

For more details see the Installation docs.

Quick Start

from czitools.metadata_tools import CziMetadata
from czitools.read_tools import read_6darray, read_stacks_list

# Read metadata without loading pixels.
mdata = CziMetadata("path/to/file.czi")
print(mdata.image_required.SizeC)
print(mdata.scale_required.X)

# Read regular, equal-sized scenes eagerly as a labelled STCZYX(A) array.
array6d, mdata = read_6darray("path/to/file.czi", use_xarray=True)

# For true on-demand Dask reads, keep scenes as a list.
scenes, dims, scene_count, mdata = read_stacks_list(
    "path/to/file.czi",
    use_dask=True,
    use_xarray=True,
)
first_plane = scenes[0].isel(T=0, C=0, Z=0).compute()

read_6darray(..., use_dask=True) produces a Dask-backed result but still reads the CZI eagerly. Use read_stacks(..., use_dask=True) or read_stacks_list(..., use_dask=True) for genuinely lazy pixel access.

For detailed usage examples see the Usage docs.

Features

CZI Well Plates and OME-Zarr HCS

from czitools.export_tools import convert_czi2hcs_ngff, validate_ome_zarr
from czitools.metadata_tools import CziMetadata
from czitools.read_tools import read_field

filepath = "path/to/plate.czi"
mdata = CziMetadata(filepath)

if mdata.hcs is None:
    raise ValueError(mdata.hcs_status.reason)

well = mdata.hcs.get_well("B04")
field, _ = read_field(filepath, well="B04", field=0)

# Requires: pip install "czitools[omezarr]"
output = convert_czi2hcs_ngff(filepath, overwrite=True)
assert validate_ome_zarr(output)

Well names accept forms such as B4, b04, and B/4. Field indices are zero-based within a well. The OME-Zarr converter writes the HCS hierarchy plate → well → field image → multiscale level.

Analysis Tools

The analysis_tools package provides image processing and HCS plate analysis utilities:

from czitools.analysis_tools import ArrayProcessor, process_hcs_omezarr, create_well_plate_heatmap

# Process 2D images with filters and object detection
proc = ArrayProcessor(image_2d)
filtered = proc.apply_gaussian_filter(sigma=2)
binary = ArrayProcessor(filtered).apply_threshold(value=100)
labelled, count, props = ArrayProcessor(binary).label_objects(
    min_size=50,
    measure_params=True,
)

# Analyze HCS OME-ZARR plates
results = process_hcs_omezarr("plate.ome.zarr", channel2analyze=0)

# Visualize results as heatmap
fig = create_well_plate_heatmap(results, num_rows=8, num_cols=12)

Requires: pip install "czitools[analysis]"

CZI inside NDV

5D CZI inside NDV

CZI inside Napari

5D CZI inside Napari

Colab Notebooks

Topic Link
Read CZI metadata Open In Colab
Read CZI pixel data Open In Colab
Read CZI well-plate data Open In Colab
Process OME-Zarr HCS plate Open In Colab
Show planetable as surface Open In Colab
Segment with Voronoi-Otsu Open In Colab

Download files

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

Source Distribution

czitools-0.20.0.tar.gz (121.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

czitools-0.20.0-py3-none-any.whl (137.0 kB view details)

Uploaded Python 3

File details

Details for the file czitools-0.20.0.tar.gz.

File metadata

  • Download URL: czitools-0.20.0.tar.gz
  • Upload date:
  • Size: 121.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for czitools-0.20.0.tar.gz
Algorithm Hash digest
SHA256 518121df6c07c4add596d9f4af77e7e2033f8e73a64cdfc88f9ad49a45332b42
MD5 ba86debd372add856402ac0dc78ec6b3
BLAKE2b-256 cc4adc6f95004b42f5c0c5db3dd86f5c2b278b78c11d8fe28af14cf180dd8ad4

See more details on using hashes here.

File details

Details for the file czitools-0.20.0-py3-none-any.whl.

File metadata

  • Download URL: czitools-0.20.0-py3-none-any.whl
  • Upload date:
  • Size: 137.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for czitools-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d6caeaf35dc05f11b9094e5b1d1e5a3f1367f6bd97df78a905257bd63bff58
MD5 1e17120ffd2db983a98e984232a23c95
BLAKE2b-256 1193cbd5119863731af7d29cab368da812b8ef4c4afed86d256e8a657a933847

See more details on using hashes here.

Release history Release notifications | RSS feed

0.20.1

2 files

This release

0.20.0 This release

2 files

0.17.2

2 files

0.17.1

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.2

2 files

0.13.1

2 files

0.13.0

2 files

0.12.0

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.3

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

Supported by

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