TIFF extractor manager module
- class library.image_manipulation.tiff_extractor_manager.TiffExtractor
Bases:
object
Includes methods to extract tiff images from czi source files and generate png files for quick viewing of downsampled images in stack
- create_checksums()
- create_previews()
- create_web_friendly_image()
Create downsampled version of full size tiff images that can be viewed on the Django admin portal. These images are used for Quality Control.
- extract_tiffs_from_czi()
Extracts TIFF images from CZI files for a specified channel. This method performs the following steps: 1. Determines the output directory and scale factor based on the downsample flag. 2. Creates the output directory if it does not exist. 3. Logs the initial state including the number of existing TIFF files in the output directory. 4. Retrieves sections from the database for the specified animal and channel. 5. For each section, extracts the TIFF image from the corresponding CZI file if it does not already exist. 6. Logs and prints errors if CZI files are missing or if no sections are found. 7. Checks for duplicate files in the output directory and logs and prints any duplicates found. :raise: SystemExit: If no sections are found in the database or if duplicate files are found.
Note, it cannot be run with threads.
- static find_duplicates(directory)
Finds duplicate files in a directory.
- library.image_manipulation.tiff_extractor_manager.calculate_hash(file_path)
Calculates the MD5 hash of a file.