Tools to simplify reading CZI (Carl Zeiss Image) meta and pixel data
Project description
czitools
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_metadata_tools.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 pixel data
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 dask array with dimension order STZCYX(A)
array6d, mdata, dim_string6d = read_tools.read_6darray(filepath,
output_order="STCZYX",
# T=0,
# Z=0
)
# show array inside napari viewer
viewer = napari.Viewer()
layers = napari_tools.show(viewer, array6d, mdata,
dim_string=dim_string6d,
blending="additive",
contrast='from_czi',
gamma=0.85,
add_mdtable=True,
name_sliders=True)
napari.run()
Remarks
The code to read multi-dimensional with delayed reading using Dask array was heavily inspired by input from: Pradeep Rajasekhar.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file czitools-0.4.1.tar.gz
.
File metadata
- Download URL: czitools-0.4.1.tar.gz
- Upload date:
- Size: 35.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7309c15b24abe7db2640a79f40ae7005fc9512bedc1a9bed6662224e8fa2bb7e |
|
MD5 | 362a40ce5faeef72a7f110758cced5cb |
|
BLAKE2b-256 | 3d93c0a06a4af921791712ded7807b6f7f5281490339ccbc0e5dc8a188833278 |
File details
Details for the file czitools-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: czitools-0.4.1-py3-none-any.whl
- Upload date:
- Size: 35.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d87c0b492dd45564df8993e0117c239f0d6fa1cceaf7e94e9a9c5868a5259c41 |
|
MD5 | d12ee3daa7f877455d4d207bf0dee999 |
|
BLAKE2b-256 | 4ca69360b7587a14c1607f60a6b8388bfeeafc8a2af00bcd23ddf90482b17904 |