MONAI/PyTorch implementation of a 3D U-Net for binary semantic segmentation of calcium waves in single-channel two-photon microscopy movies. The model was trained on GCaMP-labelled neonatal cochleae from in vivo imaging experiments (paper).
The model produces a binary calcium-wave mask. Optional post-processing converts connected regions into temporally ordered instance labels.
(time, height, width) order, supplied as a TIFF stack or OME-Zarr directory0 = background, 1 = calcium wave), with optional instance labels (0 = background, 1..N = individual waves)config.ymlconfig.ymlbest_model_binary_v2_cawaves.pthInstall the dependencies:
pip install -r requirements.txt
Run inference on a TIFF movie:
python infer_binary.py input_movie.tif --output prediction_mask.tif
Run inference on an OME-Zarr movie:
python infer_binary.py input_movie.ome.zarr --output prediction_mask.tif
To output connected-component instance labels:
python infer_binary.py input_movie.tif --output-type labels --labels-output prediction_labels.tif
To save the binary mask and instance labels:
python infer_binary.py input_movie.tif --output-type both --output prediction_mask.tif --labels-output prediction_labels.tif
To save the probability volume as well:
python infer_binary.py input_movie.tif --output prediction_mask.tif --probabilities-output prediction_probabilities.tif
The script loads config.yml and the bundled model weights. Sliding-window inference keeps the complete movie and assembled output on the CPU while processing windows on the selected accelerator.
The model was trained on two-photon fluorescence movies of GCaMP-labelled neonatal mouse cochleae, with manually curated 3D calcium-wave masks (from Voronoi-Otsu based segmentation).
Training and inference code: fedeceri85/cochlea-calcium-waves-binary-segmentation-unet3d