Skip to main content

Python utilities to read CZI files and parse metadata through python-bioformats

Project description

https://img.shields.io/pypi/v/pycziutils.svg Documentation Status

Python utilities to read (tiled) CZI files and parse metadata through python-bioformats

Installation:

$ pip install pycziutils

Features

A tiny utility module to parse Zeiss CZI files in Python through python-bioformats. Parse tiled images, organize planes into pandas.DataFrame, parse some hard-to-get metadata.

Example

import pycziutils


@pycziutils.with_javabridge
def main():
    czi_file_path="path/to/czi/file.czi"
    tiled_czi_ome_xml=pycziutils.get_tiled_omexml_metadata(czi_file_path)
    tiled_properties_dataframe=pycziutils.parse_planes(tiled_czi_ome_xml)

    print(tiled_properties_dataframe.columns)
    #Index(['index', 'X', 'Y', 'Z', 'T', 'C_index', 'T_index', 'Z_index', 'image',
    #       'plane', 'image_acquisition_T', 'absolute_T'],
    #        dtype='object')

    print(tiled_properties_dataframe.iloc[0])
    #index                                                 0
    #X                                             -1165.624
    #Y                                               122.694
    #Z                                                 0.001
    #T                                                 1.027
    #C_index                                               0
    #T_index                                               0
    #Z_index                                               0
    #image                                                 0
    #plane                                                 0
    #image_acquisition_T    2021-04-12 02:12:21.340000+00:00
    #absolute_T             2021-04-12 02:12:22.367000+00:00
    #Name: 0, dtype: object

    #returns bioformats reader for tiled images
    reader=pycziutils.get_tiled_reader(czi_file_path)
    for i, row in tiled_properties_dataframe.iterrows():
        image = reader.read(
            series=row["image"],
            t=row["T_index"],
            z=row["Z_index"],
            c=row["C_index"],
        )

if __name__=="__main__":
    main()

TODO

  • Github actions

  • Writing tests for _parsers.py

Credits

This package was created with Cookiecutter and the wboxx1/cookiecutter-pypackage-poetry project template.

This package is using pysen for linting and formatting.

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

pycziutils-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

pycziutils-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pycziutils-0.1.0.tar.gz.

File metadata

  • Download URL: pycziutils-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.7.4 Darwin/19.6.0

File hashes

Hashes for pycziutils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 071528e19c716e507031c018ba09a1b917806b8fba037c1da0d594b9e7610255
MD5 2f45d3231a7bf11466d3071b0a5c4d50
BLAKE2b-256 e269d1a240e279b894d00ca802a2146e17c292375f88de1bceaaed2fce330335

See more details on using hashes here.

File details

Details for the file pycziutils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pycziutils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.7.4 Darwin/19.6.0

File hashes

Hashes for pycziutils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72186767c886b1a76a53593822ea7aadeb2051f2f4a15a378dcda9e27af8d5cf
MD5 7041d7e5fcaa14f55141ad76667d5006
BLAKE2b-256 149aa2efc78554540d041d8e8161ac57b07f776fbbe3dcea2909170f3623984e

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