TrackMate CSV Importer¶
The TrackMate CSV Importer is a Fiji plugin that loads pre-computed spot/detection tables (CSV format) directly into TrackMate, skipping the detection step. This is the key integration point between pyCyto’s segmentation/tabulation outputs and TrackMate tracking.
Plugin page: https://imagej.net/plugins/trackmate/extensions/csv-importer
Why This Matters¶
pyCyto’s standard pipeline produces a per-cell features DataFrame (from cyto.tabulation) that contains cell centroids, sizes, and intensities per frame. Without the CSV Importer, you would have to re-run TrackMate’s built-in detection on the raw images. With the plugin, you pass the DataFrame directly — TrackMate skips detection and goes straight to tracking.
Installation¶
Auto-download mode (PyImageJ)¶
When using imagej.init('sc.fiji:fiji'), the CSV Importer is included in the default Fiji update site and is available automatically.
Pre-installed Fiji¶
/path/to/Fiji.app/ImageJ-linux64 --headless --ij2 --update \
add-update-site TrackMateCSVImporter \
https://sites.imagej.net/TrackMateCSVImporter/
/path/to/Fiji.app/ImageJ-linux64 --headless --ij2 --update update
CSV Format¶
The importer expects a CSV with at minimum these columns (matching TrackMate spot attributes):
Column |
TrackMate attribute |
Notes |
|---|---|---|
|
|
pixel or physical units |
|
|
pixel or physical units |
|
|
0-based integer |
|
|
estimated cell radius |
|
|
mean intensity, used for quality |
pyCyto’s tabulation output (data["dataframe"]) already has these columns. The cyto.tracking.trackmate wrapper handles the column mapping automatically.
Python API¶
from cyto.tracking.trackmate import TrackMateInMemoryProcessor
tracker = TrackMateInMemoryProcessor(
fiji_dir="", # "" = auto-download
verbose=True,
)
result = tracker({
"label": label_array, # OR
"features": spots_df, # pre-computed spot DataFrame
})
tracks_df = result["features"]
Scripting with scyjava¶
For advanced use, you can call the CSV Importer Java API directly:
import scyjava
CSVImporter = scyjava.jimport(
'fiji.plugin.trackmate.io.TmXmlWriter'
)
See trackmate_in_mem.md for the full in-memory TrackMate workflow.