Skip to main content

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

Project description

https://github.com/yfukai/pycziutils/actions/workflows/python-test.yml/badge.svg 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, and 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', '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                                                 Phase
    #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()

Credits

This package uses python-bioformats as a nice tool to connect CZI files to Python.

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

This package uses 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.3.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

pycziutils-0.3.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycziutils-0.3.0.tar.gz
  • Upload date:
  • Size: 8.7 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.3.0.tar.gz
Algorithm Hash digest
SHA256 a5e8654386ec0ea59c6cbb23a9762f7db8e628264c5e5943ae45734aa318622a
MD5 cbead9d21c6842e06447229181c75927
BLAKE2b-256 92ba18689c2edad9e7a8fa74033a6c1e85769205a4476b18a4cfe9c428b35a94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycziutils-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8af4d3d74d9615eb037d0f3b5f9f6df5d578a53390e9dccb9bc622888f9b27d0
MD5 33748ef95132e651091622b74d82ee6e
BLAKE2b-256 fd7818a3967500dc62fcf932e9d83ac88062bd9840d756367c371c1350d6e6fb

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