Repository navigation
Description
Follow-up to #427 (choose the tracker: ultrack, tracksdata, HOCT or Trackastra), part of #361.
Problem
After #413, biahub track writes tracks.geff next to the tracked labels, and VisCy (Biohub/VisCy#525) and the DCA layout (#363) read it. The GEFF comes from ultrack's Tracker.to_geff(tracks_df=...) (royerlab/ultrack#290). That export reads node positions and properties from ultrack's own solution database, so it can't export another tracker's results. With #427 merged, tracker: tracksdata | hoct | trackastra write the tracked labels and tracks_<fov>.csv but no tracks.geff, and they remove a stale one left by an earlier ultrack run. VisCy falls back to the CSV, but such a store doesn't meet the #361 contract.
Proposal
Add a tracker-independent GEFF writer that works from the final tracks table, i.e. after the sibling filter and the one-child merge. That table is what the labels are painted from, so the GEFF can't disagree with them.
- Nodes: one per row (
track_id, t, y, x[, z]), withseg_id = track_id(the painted value),parent_track_id, andlineage_id(the root track). - Edges: consecutive rows within a track, plus each daughter's first row to its parent's last row.
- Metadata: the same as the ultrack export, so readers can't tell them apart:
track_node_props = {tracklet: track_id, lineage: lineage_id};related_objects = [{type: labels, path: ../labels/<tracked_label>, node_prop: seg_id}];- axes in pixels/frames with
scale/scaled_unitfrom the plate; - zarr v3.
- Implementation options:
geff.writeon a networkxDiGraphbuilt from the table;geff.core_io.write_arraysdirectly, which avoids networkx and handles large FOVs;- for tracksdata/HOCT,
tracksdata's ownBaseGraph.to_geff. But the solved graph doesn't reflect the post-solve edits, so the table is the safer source.
- Optional: use the same writer for ultrack too, so all trackers share one export path and biahub no longer depends on the ultrack fork (feat(tile_stitch): honour monarch.recon_dtype as the stored output dtype #290) for it. The ultrack-only node properties (area, frontier, bbox) would be dropped.
- Validation: check the result with
geff.validate_structureand full data validation (graph, tracklet, lineage), like the ultrack export's tests.
Alternative: contribute to_geff upstream to tracksdata, Trackastra and HOCT
Rather than (or as well as) a biahub writer, the export could live in the trackers themselves, as royerlab/ultrack#288 and #290 did for ultrack. Two of the three already have a GEFF export, but neither produces what biahub writes for ultrack:
| today | missing for biahub | |
|---|---|---|
tracksdata BaseGraph.to_geff(store, geff_metadata=None, overwrite, zarr_format=3) |
writes the whole graph (candidate nodes and edges too, with the solution attribute); axes t, (z), y, x; tracklet node prop tracklet_id |
export only the solution; lineage_id + track_node_props; seg_id = the value painted into the labels; related_objects pointing at an external label image; axis units/scale |
HOCT (hoct.predict returns a tracksdata RustWorkXGraph) |
inherits tracksdata's to_geff |
same as tracksdata; nothing HOCT-specific once tracksdata has it |
Trackastra trackastra.tracking.write_to_geff(graph, masks, outdir, ...) |
writes the graph and its own copy of the masks into one zarr | an option to skip the masks and link an existing label image (related_objects), tracklet/lineage props, seg_id matching graph_to_ctc's relabelled masks, axis units/scale, zarr v3 |
Suggested contributions, mirroring ultrack's to_geff keyword arguments so callers handle every tracker the same way (zarr_format, include_masks, segmentation_path, scale, spatial_unit, time_scale, time_unit):
- tracksdata: extend
to_geffwith a solution-only export, lineage andseg_idprops,track_node_props,related_objectsand units/scale. HOCT gets it for free. - Trackastra: the same options on
write_to_geff, including writing no masks when an external label image is linked. tracks_df=-style override: biahub edits the tracks after solving (sibling filter, one-child merge), as ultrack'sfilter_short_sibling_tracksdoes. Each export would need a way to restrict and relabel to the final table, like Export GEFF from a tracks DataFrame (consistent with filter_short_sibling_tracks) royerlab/ultrack#290'stracks_df=, so the GEFF matches the labels.
Trade-off: upstream exports help everyone who uses those tools directly, but biahub would depend on three more upstream releases, and still needs the tracks_df-style hook. The biahub writer above covers all trackers immediately. The two aren't exclusive: biahub can ship its writer now and switch tracker by tracker as upstream exports gain these options.
Acceptance
biahub track with any tracker: writes <stem>.geff that passes geff validation, whose seg_ids per frame equal the tracked label values, and that VisCy#525's reader turns into the same table as the CSV.
Activity
Merge origin/main into feat/track-tracksdata-hoct
ieivanov commentedon Oct 26, 2026
I would prefer we contribute
to_geffmethods upstream. The Royer lab may chose to develop a small geff writer, instead of maintaining methods in each repo.tayllatheodoro commentedon Oct 27, 2026
Agreed on upstream. A note on what the libraries already have (installed versions in the
trackextra), and the catch for a shared writer:Tracker.to_geff/ultrack.core.export.geff.to_geff(biahub uses it through your fork, which takes the finaltracks_df)BaseGraph.to_geff(geff_store, geff_metadata=None, overwrite=False, zarr_format=3). HOCT's solutions are tracksdata graphs too, so this covers bothtrackastra.tracking.utils.write_to_geff(...)The catch: biahub edits the tracks after the tracker. It merges one-child links into their parent and applies the sibling filter (
min_sibling_length), and with #446 it also maps tracks found on downsampled labels back to full resolution. A GEFF written from a tracker's raw output would then disagree with thelabels/tracks_<labels>and the CSV biahub writes. So the writer needs to start from the final tracks table plus the tracked labels, as your ultrack fork does withtracks_df.One option for the small shared writer: build a tracksdata graph from the final tracks table and labels (nodes = (t, track_id) objects with their masks, edges = consecutive frames of a track plus parent -> daughter links), then call its
to_geff. That would make one code path for all four trackers, withseg_idlinking each node to the labels.tayllatheodoro commentedon Oct 27, 2026
@ieivanov we like the shared-writer option: build a tracksdata graph from biahub's final tracks table and tracked labels, then call its
to_geff.labels/tracks_<labels>and the CSV after the one-child merge, the sibling filter and feat(track): downsample setting for HOCT and Trackastra #446's downsampling.Would you put it in tracksdata (e.g. a "tracks table + labels -> graph" constructor) so other projects can reuse it, or start in biahub? We're happy to write it either way. If biahub, it fits the
tracking/postprocess.pyof #449.ieivanov commentedon Nov 2, 2026
@tayllatheodoro yes, the idea is to "build a tracksdata graph from the final tracks table and labels (nodes = (t, track_id) objects with their masks, edges = consecutive frames of a track plus parent -> daughter links), then call its to_geff". Please consult with @JoOkuma on where that should live, preferrably not in biahub.