Skip to main content

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

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 (needs to be installed). 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 = 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)

# try to write XML to file
xmlfile = czimd.writexml(filepath)

# get info about the channels
czi_channels = czimd.CziChannelInfo(filepath)

# get the complete metadata from the CZI as one big object
czimd_complete = czimd.get_metadata_as_object(filepath)

# get an object containing only the dimension information
czi_dimensions = czimd.CziDimensions(filepath)

# get an object containing only the dimension information
czi_scale = czimd.CziScaling(filepath)

# get an object containing information about the sample
czi_sample = czimd.CziSampleInfo(filepath)

# get info about the objective, the microscope and the detectors
czi_objectives = czimd.CziObjectives(filepath)
czi_detectors = czimd.CziDetector(filepath)
czi_microscope = czimd.CziMicroscope(filepath)

# get info about the sample carrier
czi_sample = czimd.CziSampleInfo(filepath)

# get additional metainformation
czi_addmd = czimd.CziAddMetaData(filepath)

# get the complete data about the bounding boxes
czi_bbox = czimd.CziBoundingBox(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, mdata, dim_string6d = pylibczirw_tools.read_6darray(filepath,
                                                             output_order="STZCYX",
                                                             output_dask=False,
                                                             remove_adim=True
                                                             )

# show array inside napari viewer
viewer = napari.Viewer()
layers = napari_tools.show(viewer, array6d, mdata,
                           dim_string=dim_string6d,
                           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.3.0.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

czitools-0.3.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: czitools-0.3.0.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for czitools-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f472573d2013a8b0debefca49a44234ccbf4c2b572b37817450dc084f6e40383
MD5 62a4e17965b0b1bde3e861e27ff444cc
BLAKE2b-256 8424ca87661a15aaf178a7b58d2619d119c695847d691d59bf64e2fdaf18501f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: czitools-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for czitools-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e122968332e2d22e1cbb02a9af2603accaedb2f4a062f390af4c12ab0b24b7a
MD5 4c12294c2cd46c386acb0c34f2dd1902
BLAKE2b-256 c3711bfa2afa8863f886c1f49d321cb112eeedc500ec1a669406d80d073a8f18

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