CZI manager module
This module takes care of the CZI file management. We used to use the bftool kit (https://www.openmicroscopy.org/) which is a set of Java tools, but we opted to use a pure python library that can handle CZI files. https://github.com/AllenCellModeling/aicspylibczi
- class library.image_manipulation.czi_manager.CZIManager(czi_file)
Bases:
library.image_manipulation.file_logger.FileLogger
Methods to extract meta-data from czi files using AICSImage module (Allen Institute)
- extract_metadata_from_czi_file(czi_file, czi_file_path, debug: bool = False)
This will parse the xml metadata and return the relevant data.
- Parameters
czi_file – string of the CZI file name
czi_file_path – string of the CZI path
- Returns
dictionary of the metadata
- get_scene(scene_index, channel, scale=1)
Gets the correct scene from the slide
- Parameters
scene_index – integer of the scene index
channel – integer of the channel
scale – integer of the scale. Usually either 1 or 16 (full or downsampled)
- Returns
the scene
- get_scene_dimension(scene_index)
Gets the bounding box size of the scene
- Parameters
scene_index – integer of the scene index
- Returns
x,y,width and height of the bounding box
- library.image_manipulation.czi_manager.extract_png_from_czi(file_key: tuple, normalize: bool = True)
This method creates a PNG file from the TIFF file. This is used for viewing on a web page.
- Parameters
file_key – tuple of _, infile, outfile, scene_index, scale
normalize – a boolean that determines if we should normalize the TIFF
- library.image_manipulation.czi_manager.extract_tiff_from_czi(file_key: tuple)
Gets the TIFF file out of the CZI and writes it to the filesystem
- Parameters
file_key – a tuple of: czi_file, output_path, checksum_filepath, scenei, channel, scale