Skip to main content

Tools to simplify reading CZI (Carl Zeiss Image) meta- and pixel data in Python

Project description

czitools

PyPI PyPI - Downloads License Python Version Development Status

This repository provides a collection of tools to simplify reading CZI (Carl Zeiss Image) pixel and metadata in Python. In addition it also contains other useful utilities to visualize CZI images inside Napari.

Reading the metadata

Please check use_pylibczirw_metadata_class.py for some examples.

# get the metadata at once as one big class
mdata_sel = czimd.CziMetadata(filepath)

# get only specific metadata
czi_dimensions = czimd.CziDimensions(filepath)
print("SizeS: ", czi_dimensions.SizeS)
print("SizeT: ", czi_dimensions.SizeT)
print("SizeZ: ", czi_dimensions.SizeZ)
print("SizeC: ", czi_dimensions.SizeC)
print("SizeY: ", czi_dimensions.SizeY)
print("SizeX: ", czi_dimensions.SizeX)

# and get more info about various aspects of the CZI
czi_scaling = czimd.CziScaling(filepath)
czi_channels = czimd.CziChannelInfo(filepath)
czi_bbox = czimd.CziBoundingBox(filepath)
czi_info = czimd.CziInfo(filepath)
czi_objectives = czimd.CziObjectives(filepath)
czi_detectors = czimd.CziDetector(filepath)
czi_microscope = czimd.CziMicroscope(filepath)
czi_sample = czimd.CziSampleInfo(filepath)

Reading CZI pixeldata

While the pylibCZIrw is focussing on reading individual planes it is also helpful to read CZI pixel data as a STZCYX(A) stack. Please check use_pylibczirw_md_read.py for some examples.

# return a array with dimension order STZCYX(A)
mdarray, dimstring = pylibczirw_tools.read_mdarray(filepath, remove_Adim=True)

# remove A dimension do display the array inside Napari
dim_order, dim_index, dim_valid = czimd.CziMetadata.get_dimorder(dimstring)

# show array inside napari viewer
viewer = napari.Viewer()
layers = napari_tools.show(viewer, mdarray, mdata,
                           dim_order=dim_order,
                           blending="additive",
                           contrast='napari_auto',
                           gamma=0.85,
                           add_mdtable=True,
                           name_sliders=True)

napari.run()

5D CZI inside Napari

Project details


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.0.3.tar.gz (36.9 MB view details)

Uploaded Source

Built Distribution

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

czitools-0.0.3-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: czitools-0.0.3.tar.gz
  • Upload date:
  • Size: 36.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for czitools-0.0.3.tar.gz
Algorithm Hash digest
SHA256 87d216414386767fdd1c16276f143e2ff231b7f396e4b86cbbab90dd9a0bcba9
MD5 7e451225b595bec1b8382ce9f716c42e
BLAKE2b-256 561b0bc3f6200410943a13fc13f729c807090250a4c8db28dab95baeffb11b48

See more details on using hashes here.

File details

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

File metadata

  • Download URL: czitools-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for czitools-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ea13a457a2c289499ad8cbda2b6b29a627b1ead30e9a7ca480e01ba39dbf68ad
MD5 552118e85083a1b52d51579dc77d76b2
BLAKE2b-256 1364f5f1eb5862aa0c6fccb4ab5bfeb62c7602c528932b4c55ab1a88c8dbb2f5

See more details on using hashes here.

Supported by

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