Skip to main content

ByoTrack

License PyPi Python Downloads Codecov Lint and Test Documentation Status

pipeline

ByoTrack is a Python library for tracking biological objects in microscopy videos (2D and 3D).

Its goal is to provide a fast, modular, and research-friendly tracking framework that integrates seamlessly with the Python scientific ecosystem and established bioimage analysis platforms such as Fiji, Icy and Napari.

ByoTrack defines a modular tracking API that can be easily extended to design and evaluate new methods. It also includes implementations of several state-of-the-art detection and tracking approaches following this API.

Some components are implemented natively in Python (e.g. WaveletDetector, KalmanLinker, KOFT, RTSSmoother, EMC2Stitcher), while others wrap existing tools (e.g. StarDistDetector, IcyEMHTLinker, TrackMateLinker), integrating with external software.

In addition, ByoTrack provides utilities for data loading and preprocessing, as well as evaluation and visualization of tracking results.

[!NOTE] ByoTrack has been primarily developed for scenarios involving up to a few thousand targets in 2D or 3D microscopy data. Some components assume that individual frames fit in memory, which may limit scalability to very large 3D volumes. If you encounter limitations with your use case, feel free to open an issue or contribute a pull request.

[!WARNING] v2.0.0 introduces breaking changes to the Detections and Video APIs. If you are upgrading from v1.x, please read the Changelog for details and migration guidance.

🏆 ByoTrack (PAST-FR) won the Cell Linking Benchmark of the Cell Tracking Challenge with its SKT/KOFT implementation (see our paper for details).


Installation

pip

pip install byotrack

Some components require additional dependencies that are not installed with the library by default. For these components, you need to install their specific dependencies. Here is the complete list:

From source

git clone git@github.com:raphaelreme/byotrack.git  # OR https://github.com/raphaelreme/byotrack.git
cd byotrack
pip install .

Getting started

import byotrack
import byotrack.napari.viewer  # Requires Napari

# Load some specific implementations
from byotrack.implementation.detector.wavelet import WaveletDetector
from byotrack.implementation.linker.frame_by_frame.kalman_linker import KalmanLinkerParameters, KalmanLinker
from byotrack.implementation.refiner.interpolater import ForwardBackwardInterpolater

# Read a video from a path, normalize and select channel
video = byotrack.Video(video_path)  # File/folder on disk or directly from array in RAM
video = video.normalize(q_min=0.01, q_max=0.999)[..., :1]  # First channel. Ignore other channels if any.

byotrack.napari.visualize(video)

# First, let's detect targets with the Wavelet Spot Detector
## Smaller scale <=> search for smaller spots
## The noise threshold is linear with k. If you increase it, you will retrieve less spots.
detector = WaveletDetector(scale=1, k=3.0, min_area=5.0)
detections_sequence = detector.run(video)

byotrack.napari.visualize(video, detections_sequence)

# Then, let's use a KalmanLinker with default parameters estimated from the detections
specs = KalmanLinkerParameters(  # Check the documentation for more parameters
    track_building="detection",  # Position from detections (non-smoothed)
).estimate(detections_sequence)
linker = kalman_linker.KalmanLinker(specs)
tracks = linker.run(video, detections_sequence)

# Last, you may filter short tracks and interpolate over missed detections if any
tracks = [track for track in tracks if len(track) > 50]  # Keep only tracks than last 50 frames
tracks = ForwardBackwardInterpolater().run(video, tracks)  # Interpolate over missed detections

# Final visualization
byotrack.napari.viewer.visualize(video, detections_sequence, tracks)

# Export tracks
byotrack.Track.save(tracks, output_path)

Please refer to the official documentation (https://byotrack.readthedocs.io/en/latest/).


Tracking Pipeline

ByoTrack implements a modular multi-step tracking pipeline:

Video → Detection → Detection Refinement → Linking → Track Refinement

Detection

Detect objects in each frame.

Implemented detectors:

  • Wavelet detector [2]
    Similar to the Icy implementation but rewritten in PyTorch

  • StarDist [3]
    Wrapper for inference (training is performed using the official StarDist library)

Detection Refinement

Filter, refine, split and merge detections.

Implemented detection refiners:

  • Detection filtering
    Filter detections based on intensity and size criteria.

  • Watershed
    Convert semantic (binary) segmentation into instance segmentation with Watershed
    Can also be applied to instance segmentation to refine the instances found

Linking

Associate detections across frames.

Implemented linkers:

  • Nearest-neighbor linking

    • Euclidean
    • Optical flow
    • Kalman filtering (SKT) [9]
    • KOFT (Kalman + Optical Flow Tracker) [9]
    • optional adaptive gating [12]
  • EMHT [4]
    Wrapper around the Icy implementation

  • TrackMate / u-track [7]
    Wrapper around Fiji's TrackMate implementation [6,8]

Track Refinement

Post-processing operations applied to tracks:

  • Cleaning
    Remove outliers tracks based on length and motion criteria

  • Gap Closing / Stitching
    Tracklet Stitching via EMC2 algorithm [5]

  • Interpolation
    Replace miss-detection by an interpolated position
    Extrapolate tracks on the full temporal sequence

  • Smoothing
    RTS optimal Kalman smoother


Data, Evaluation & Utilities

Data input

ByoTrack supports:

  • Most standard video formats via OpenCV
  • TIFF stacks
  • Folder of images (sorted by name)
  • Dedicated Python loading of the video (np.array) and detections (converted as a Detections object)

Note that microscope private formats are not supported but can be converted into TIFF manually using bftools

Optical flow

Optical flow can be used for:

  • Linking detections
  • Gap closing / Stitching
  • Interpolation

Currently provide wrappers around implementations from:

  • OpenCV (TVL1, Farneback) (Only 2D)
  • Scikit-Image (ILK, TVL1) (2D + 3D)

Datasets

Built-in loaders for common benchmarks:

  • Cell Tracking Challenge (CTC) [10]
  • SINETRA [11]

Metrics

Evaluation utilities for:

  • Segmentation
  • Detection
  • Tracking

Currently implemented:

  • Cell Tracking Challenge metrics

More metrics will be added in future releases.


Cell Tracking Challenge

Our submission (PAST-FR) to the Cell Linking Benchmark of the Cell Tracking Challenge is available in the examples/ctc folder.


Contributing

Contributions are very welcome! Feel free to open an issue or submit a pull request.

Typical contributions could include:

  • New detections or linking algorithms
  • Dataset loaders
  • Evaluation metrics
  • New data format
  • Track analysis methods

See the contribution guidelines.


Cite us

If you use ByoTrack in your research, please cite:

@article{hanson2024automatic,
  title={Automatic monitoring of neural activity with single-cell resolution in behaving Hydra},
  author={Hanson, Alison and Reme, Raphael and Telerman, Noah and Yamamoto, Wataru and Olivo-Marin, Jean-Christophe and Lagache, Thibault and Yuste, Rafael},
  journal={Scientific Reports},
  volume={14},
  number={1},
  pages={5083},
  year={2024},
  publisher={Nature Publishing Group UK London}
}

References

  • [1] F. De Chaumont, S. Dallongeville, N. Chenouard, et al., "Icy: an open bioimage informatics platform for extended reproducible research", Nature methods, 2012.
  • [2] J.-C. Olivo-Marin, "Extraction of spots in biological images using multiscale products", Pattern Recognition, 2002.
  • [3] U. Schmidt, M. Weigert, C. Broaddus, and G. Myers, "Cell detection with star-convex polygons", MICCAI, 2018.
  • [4] N. Chenouard, I. Bloch, and J.-C. Olivo-Marin, "Multiple hypothesis tracking for cluttered biological image sequences", IEEE TPAMI, 2013.
  • [5] T. Lagache, A. Hanson, J. Perez-Ortega, et al., "Tracking calcium dynamics from individual neurons in behaving animals", PLoS Computational Biology, 2021.
  • [6] J. Schindelin, I. Arganda-Carreras, E. Frise, et al., "Fiji: an open-source platform for biological-image analysis", Nature Methods, 2012.
  • [7] K. Jaqaman, D. Loerke, M. Mettlen, et al., "Robust single-particle tracking in live-cell time-lapse sequences.", Nature Methods, 2008.
  • [8] J.-Y. Tinevez, N. Perry, J. Schindelin, et al., "TrackMate: An open and extensible platform for single-particle tracking.", Methods, 2017.
  • [9] R. Reme, A. Newson, E. Angelini, J.-C. Olivo-Marin and T. Lagache, "Particle tracking in biological images with optical-flow enhanced kalman filtering", IEEE ISBI, 2024.
  • [10] M. Maška, V. Ulman, D. Svoboda, P. Matula, et al., "A benchmark for comparison of cell tracking algorithms", in Bioinformatics, 2014.
  • [11] R. Reme, A. Newson, E. Angelini, J.-C. Olivo-Marin and T. Lagache, "SINETRA: a Versatile Framework for Evaluating Single Neuron Tracking in Behaving Animals", IEEE ISBI, 2025.
  • [12] A. Genovesio, Z. Belhassine, and J.-C. Olivo-Marin, "Adaptive gating in Gaussian Bayesian multi-target tracking", IEEE ICIP, 2004.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

byotrack-2.0.1.tar.gz (142.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

byotrack-2.0.1-py3-none-any.whl (192.1 kB view details)

Uploaded Python 3

File details

Details for the file byotrack-2.0.1.tar.gz.

File metadata

  • Download URL: byotrack-2.0.1.tar.gz
  • Upload date:
  • Size: 142.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for byotrack-2.0.1.tar.gz
Algorithm Hash digest
SHA256 0c8f46cd5f486710607db0277dd06558285d1affcf18a1e4de2b5db761bb0856
MD5 d1c4a29b7c35d7ef932be66bf1ea59c1
BLAKE2b-256 47d0cb359d545a0168c73b9564b0283c2994d0de7681b72ded6ad64ff1070a79

See more details on using hashes here.

File details

Details for the file byotrack-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: byotrack-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 192.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for byotrack-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 afad8736a0c7435d0686b92353f0fa8d6a48ea94d919a414f7436c81295049ef
MD5 40dffdc7541632e9e252d1b75511fb18
BLAKE2b-256 18d421e60b8fef8996e57ba3a75adf14387a10354f538b369a2f4848c97ecc04

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

This release

2.0.1 This release

2 files

2.0.0

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.12

2 files

1.3.11

2 files

1.3.10

2 files

1.3.9

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page