Cochlear Calcium Wave Binary Segmentation
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.
Model
- Input: single-channel 3D movie in
(time, height, width)order, supplied as a TIFF stack or OME-Zarr directory - Output: binary mask (
0= background,1= calcium wave), with optional instance labels (0= background,1..N= individual waves) - Architecture: MONAI 3D U-Net defined in
config.yml - Config:
config.yml - Weights:
best_model_binary_v2_cawaves.pth
Use
Install 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.
Training Data
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).
Code
Training and inference code: fedeceri85/cochlea-calcium-waves-binary-segmentation-unet3d
