API Reference

class pylibczi.CziFile(czi_filename, metafile_out='', use_pylibczi=True, verbose=False)[source]

Zeiss CZI file object.

Args:
czi_filename (str): Filename of czifile to access.
Kwargs:
metafile_out (str): Filename of xml file to optionally export czi meta data to.
use_pylibczi (bool): Set to false to use Christoph Gohlke’s czifile reader instead of libCZI.
verbose (bool): Print information and times during czi file access.

Note

Utilizes compiled wrapper to libCZI for accessing the CZI file.

static plot_image(image, figno=1, doplots_ds=1, reduce=<function mean>, interp_string='nearest', show=True)[source]

Generic image plot using matplotlib.

Kwargs:
figno (int): Figure number to use.
doplots_ds (int): Downsampling reduce factor before plotting.
reduce (func): Function to use for block-reduce downsampling.
interp_string (str): Interpolation string for matplotlib imshow.
show (bool): Whether to show images or return immediately.
read_image()[source]

Read image data from all subblocks and create single montaged image.

Returns:
(m,n,nchan ndarray): Montaged image from all subblocks.
read_meta()[source]

Extract all metadata from czifile.

Attributes Modified:
meta_root (etree): xml class containing root of the extracted meta data.
class pylibczi.CziScene(czi_filename, scene=1, ribbon=0, metafile_out='', tifffile_out='', verbose=False)[source]

Zeiss CZI scene image and metadata.

Access functions allow for reading of czi metadata to extract information for a particular scene.

Args:
czi_filename (str): Filename of czifile to access scene information in.
Kwargs:
scene (int): The scene to load in czifile (starting at 1).
ribbon (int): The ribbon to crop to (starting at 1). Negative value disables the ribbon cropping.
metafile_out (str): Filename of xml file to export czi meta data to.
tifffile_out (str): Filename of tiff file to export czi scene image to.
verbose (bool): Print information and times during czi file access.

Note

Utilizes compiled wrapper to libCZI for accessing the CZI file.

export_tiff(save_tiff_ds=8, reduce=<function mean>, fn=None)[source]

Export scene image to tiff file.

Kwargs:
save_tiff_ds (int): Downsampling reduce factor before exporting.
fn (str): Filename of tiff to export (default to filename provided in init)
get_scene_info()[source]

Access function for returning image and scene information.

Returns:
(m,n,nchan ndarray): The scene image.
(list of n,2 ndarray): List of polygons defining slices in pixels.
(list of n,2 ndarray): List of polygons defining ROIs in pixels.
(2, array): Top-left coordinates of the polygon bounding box in pixels.
(2, array): Size of the polygon bounding box in pixels.

Note

Loads the metadata and scene or ribbon if not currently loaded.

plot_scene(figno=1, doplots_ds=1, reduce=<function mean>, interp_string='nearest', show=True)[source]

Plot scene data using matplotlib.

Kwargs:
figno (int): Figure number to use.
doplots_ds (int): Downsampling reduce factor before plotting.
reduce (func): Function to use for block-reduce downsampling.
interp_string (str): Interpolation string for matplotlib imshow.
show (bool): Whether to show images or return immediately.
classmethod readScene(args)[source]

Classmethod to create a CziScene object from args (argparse).

Kwargs:
args (argparse.Namespace): As returned by parse_args()
read_scene_image()[source]

Load scene image from czifile. Loads metadata if not currently loaded.

Args:

Kwargs:

Attributes Modified:
img (m,n,nchan ndarray): The loaded image data with data type matching that of the image.
read_scene_meta()[source]

Extract metadata from czifile relevant for scene.

Note

Sets class member variables from metadata pertaining to loading the initialized scene (or ribbon).