Cell Tracking Challenge (CTC)
IOs for CTC datasets [10].
We provide loading and saving functions for detections and tracks.
- byotrack.dataset.ctc.load_detections(path: str | os.PathLike) list[byotrack.Detections]
Load detections stored in the CTC format [10].
The CTC format for detections consists of one tiff file for each frame which contains the instance segmentation on the frame.
See the official documentation of the CTC format at https://public.celltrackingchallenge.net/documents/Naming%20and%20file%20content%20conventions.pdf
This will simply run the byotrack.GroundTruthDetector on the given folder to load the detection in memory.
- Parameters:
path (str | os.PathLike) – Path to the detections data
- Returns:
Loaded detections
- Return type:
list[byotrack.Segmentation]
- byotrack.dataset.ctc.load_tracks(path: str | os.PathLike) list[byotrack.Track]
Load tracks stored in the CTC format [10].
The CTC format for tracks consists of one tiff file for each frame which contains the segmentation of active tracks on the frame and a text file containing track ids, start and end frames and parent track.
First the code parses the segmentation tiff files (either “man*{frame_id}.tif” or “mask{frame_id}.tif”) and recovers all the known positions (plus the associated detections_ids) of the tracks. Then it parses the metadata in the txt file (either “man_track.txt” or “res_track.txt”) and validate the tracks creation.
See the official documentation of the CTC format at https://public.celltrackingchallenge.net/documents/Naming%20and%20file%20content%20conventions.pdf
Example:
import byotrack import byotrack.visualize from byotrack.dataset import ctc # Load the video and normalize it video = byotrack.Video("dataset/01") # Load videos video = video.normalize() # Optionally, load ground-truth segmentations (may take a lot of RAM) detections_sequence = ctc.load_detections("dataset/01_GT/TRA") # Load ground-truth tracks tracks = ctc.load_tracks("dataset/01_GT/TRA") # Visualize everything byotrack.visualize.InteractiveVisualizer(video, detections_sequence, tracks)
- Parameters:
path (str | os.PathLike) – Path to the tracks data
- Returns:
Loaded tracks
- Return type:
list[byotrack.Track]
- byotrack.dataset.ctc.save_detections(detections_sequence: Sequence[byotrack.Detections], path: str | os.PathLike, *, as_res=True, as_seg=False, n_digit=4) None
Save detections in the CTC format [10].
It will save one tiff image for each frame containing the segmentation of objects.
See the official documentation of the CTC format at https://public.celltrackingchallenge.net/documents/Naming%20and%20file%20content%20conventions.pdf
- Parameters:
path (str | os.PathLike) – Folder path where to store the .tif files
detections_sequence (Sequence[byotrack.Detections]) – Detections for each frame
as_res (bool) – Whether to store as a results or as a ground-truth. Ground-truth are stored as “man_trackT.tif” Results as “maskT.tif” Default: True
as_seg (bool) – Only for ground-truth: file names are “man_segT.tif” instead of “man_trackT.tif” Default: False
n_digit (int) – Number of digit used to encode time in file names. Default: 4
- byotrack.dataset.ctc.save_tracks(tracks: Collection[byotrack.Track], path: str | os.PathLike, *, detections_sequence: Sequence[byotrack.Detections] = (), as_res=True, as_seg=False, default_radius=3.0, last=0, shape: tuple[int, ...] | None = None, n_digit=4, anisotropy=1.0, overwrite_detections=False) None
Save tracks in the CTC format [10].
It will save one tiff image for each frame containing the segmentation of objects and a metadata txt file describing the tracks identifiers, start/end frames and parents.
Parent information is not supported yet.
When no detections_sequence is given, tracks segmentations are simply drawn as disk with default_radius at the track localization. When detections_sequence is given, then for tracks without detections associated, a disk is drawn with default_radius (set at 0 to drop this behavior), otherwise the detection segmentation is used.
For smarter behaviors, one can directly modify the segmentation before saving.
See the official documentation of the CTC format at https://public.celltrackingchallenge.net/documents/Naming%20and%20file%20content%20conventions.pdf
- Parameters:
path (str | os.PathLike) – Folder path where to store the .tif files
tracks (Collection[byotrack.Track]) – Tracks to save
detections_sequence (Sequence[byotrack.Detections]) – Optional detections for each frame Default: ()
as_res (bool) – Whether to store as a results or as a ground-truth. Ground-truth are stored as “man_trackT.tif” and “man_track.txt” Results as “maskT.tif” and “res_track.txt” Default: True
as_seg (bool) – Only for ground-truth: file names are “man_segT.tif” instead of “man_trackT.tif” Note that it will also store the meta data to allow reloading the tracks. Default: False
default_radius (float) – Radius of drawn disk when no segmentation is available. Default: 5.0 (pixels)
last (int) – Overwrite last frame to consider Default: 0 (Will compute it from the last tracked target)
shape (tuple[int, ...] | None) – Optional shape. Required when no detections_sequence is provided Default: None
n_digit (int) – Number of digit used to encode time in file names. Default: 4
anisotropy (float) – Relative size of a pixel along the depth dimension versus height/width dimensions. Default: 1.0
overwrite_detections (bool) – Overwrite the segmentation of objects with disk. Default: False (Disk are only drawn on background)