cyto.tracking¶
Cell tracking algorithms — Fiji/TrackMate integration, in-memory TrackMate, and Trackpy feature-point linking.
- class cyto.tracking.trackmate.TrackMate(FIJI_DIR='', ij=None, linking_max_distance=15.0, max_frame_gap=5, gap_closing_max_distance=15.0, pixel_size=1.0, size_min=None, size_max=None, verbose=True, use_in_memory=True)[source]¶
Bases:
object
TrackMate In-Memory Processing Example
This module demonstrates how to: 1. Load pre-segmented label data and corresponding images 2. Extract cell data to CSV format from labels 3. Use TrackMate for particle tracking via pyimagej scripting
Requirements: - pyimagej - imagej with TrackMate plugin - numpy - pandas - scikit-image - tifffile (for loading TIFF files)
- class cyto.tracking.trackmate_in_mem.TrackMateInMemoryProcessor(imagej_path: str | None = None, ij=None)[source]¶
Bases:
objectHandles tracking using pyimagej and TrackMate with pre-segmented data
- create_trackmate_model(spots_df: DataFrame, image_shape: Tuple[int, ...], pixel_size: float = 1.0, time_interval: float = 1.0) Tuple[Any, Any][source]¶
Create TrackMate model from spots DataFrame
- Parameters:
spots_df – DataFrame containing spot information
image_shape – Shape of the original image (height, width) or (frames, height, width)
pixel_size – Physical pixel size in micrometers
time_interval – Time interval between frames in minutes
- Returns:
Tuple of (model, settings)
- export_tracking_results(model: Any, output_dir: Path) Dict[str, Path][source]¶
Export tracking results to CSV format compatible with TrackMate CSV importer
- Parameters:
model – TrackMate model with tracking results
output_dir – Directory to save results
- Returns:
Dictionary with paths to exported files
- labels_to_spots_csv(labels: ndarray, image: ndarray, time_points: List[int] | None = None) DataFrame[source]¶
Convert label image to CSV format suitable for TrackMate using cyto.utils.label_to_table.label_to_sparse
- Parameters:
labels – Label image from segmentation (XYT format)
image – Original intensity image (XYT format)
time_points – List of time points (for time series)
- Returns:
DataFrame with spot information in TrackMate format
- cyto.tracking.trackmate_in_mem.run_trackmate_on_data()[source]¶
Main function to run TrackMate tracking on your specific data files
Note
cyto/tracking/trackmate_script_run.py is a Fiji script that uses
ImageJ parameter injection (#@ File syntax). It is not importable as a
standard Python module and is excluded from this API reference.