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. It is also available as a Python Package on PyPi

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)
array6d, dimstring = pylibczirw_tools.read_6darray(filepath,
                                                   dimorder="STCZYX",
                                                   output_dask=False,
                                                   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.8.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

czitools-0.0.8-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: czitools-0.0.8.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for czitools-0.0.8.tar.gz
Algorithm Hash digest
SHA256 39a3668ca6bd4223eff4758056bfb14bdd30d8d4f4bcebf3a3976070f73ca7d5
MD5 241311bedcc65953ccf0a2e0dded6dd7
BLAKE2b-256 935892cb6737a4cc5ac27d613f0eef275a80dc90d9e62bad5b3ad0a6fe768553

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for czitools-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fa1a0785ecfc13549225a95527b4d5de7eca8e30f38930cbd851e1d5eac1f3c4
MD5 9312a54a5c6a27929c828412db419762
BLAKE2b-256 9c5c98ffee0faa5189d3b64ad3c453eaca4f2c8911df425673696e0145847275

See more details on using hashes here.

Supported by

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