Repository with a collection of tools for working with COMET imaging data.
Notebook for performing background subtraction from original raw COMET ome.tiff files the notebook uses the same Normalized Subtraction formula used by the HORIZON software (see user manual), and the resulting images are equivalent.
The method available in HORIZON for background subtraction is Normalized Subtraction
which applies the following transformation to the pixels of the channel:
𝑃𝑆 = 𝑃𝑂 − (𝑃𝐵 × 𝐸𝑂) / 𝐸𝐵
With P the pixel value, E the exposure time, S the subtracted channel, O the original
channel and B the background channel
The original metadata are rewritten to the image to mantain compatibility with the horizon software.
Tested from a pip3 environment with python 3.11.
Requirements:
dask
tifffile
ome_types
unidecode
opencv
The notebook expects three input parameters:
- Path to the raw .ome.tiff COMET file.
- Path to the output image
- Dictionary describing the background subtraction operations:
Define the subtraction channels:
{
"NEW_CHANNEL_NAME": ("RAW_CHANNEL", "BG_CHANNEL"|None),
...
}
If the background channel is None, then the raw channel is rewritten as is Only channels mentioned in the dictionary are included in the output E.g. to include the original background channels add them in the dict with the background channel set to None
An OME-TIFF file with the subtracted background channels and updated metadata.
Convert to a simple python script usable for batch processing.
Script to register and merge two OME-TIFF files derived from interrupted COMET runs for which the original tiles are not available. The registration is performed with palom: https://github.com/labsyspharm/palom
From the command line:
python3 comet_fixer.py image1 image2 output_image
Tested from a mamba/conda environment with python 3.11.
Requirements:
palom
dask
tifffile
ome_types
unidecode
The script expects three positional input parameters:
- Path to the first OME-TIFF file derived from the same interrupted COMET run.
- Path to the second OME-TIFF file derived from the same interrupted COMET run.
- Path to the output image, if the
.ome.tiffextension is not present, the script adds it.
An OME-TIFF file with all the channels from the two files registered, and the run metadata from the first file. The channel and cycle metadata from the second file are added to the ones from the first and written to the output. The output OME-TIFF file can be read with:
- COMET Horizon VIewer (proprietary): https://lunaphore.com/products/horizon/
- napari with the napari-tiff plugin (open-source).
Take as input a folder with an arbitrary number of images from the same run, instead of 2 files.