Skip to content

fix metadata loss in to_geff - #333

Merged
TeunHuijben merged 2 commits into
royerlab:mainfrom
TeunHuijben:fix-metadata-loss
Aug 7, 2026
Merged

fix metadata loss in to_geff#333
TeunHuijben merged 2 commits into
royerlab:mainfrom
TeunHuijben:fix-metadata-loss

Conversation

@TeunHuijben

Copy link
Copy Markdown
Contributor

Fix graph metadata loss in to_geff + add graph-less metadata reader

Problem

Downstream libraries need shape (the dense segmentation shape) to survive a geff
round-trip. Two things blocked that:

  1. to_geff silently dropped all graph metadata when the caller supplied its own
    GeffMetadata — the merge into extra["tracksdata"] only ran in the
    geff_metadata is None branch. from_geff already read the extras back, so only
    the write path was broken.
  2. No way to read that metadata before you have a graph, so callers hardcoded
    extra["tracksdata"]["shape"] — a private detail we couldn't move.

Changes

  • to_geff merges graph metadata into extra["tracksdata"] for caller-supplied
    metadata too. Caller entries win on collisions; the caller's object isn't mutated.
  • New tracksdata.io.read_graph_metadata(source), taking a store/path or an
    already-parsed GeffMetadata. Returns {} for non-tracksdata geffs.
  • Docstring notes shape is the canonical key (matching GraphArrayView/to_ctc).

Note: values pass through JSON, so (5, 100, 100) reads back as [5, 100, 100].

@TeunHuijben
TeunHuijben requested a review from JoOkuma August 7, 2026 17:28

@JoOkuma JoOkuma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
An optional suggestion, it might be worth considering merging io._geff_metadata and io._geff_dtypes

@TeunHuijben

Copy link
Copy Markdown
Contributor Author

Thanks! I merged the files

@JoOkuma

JoOkuma commented Aug 7, 2026

Copy link
Copy Markdown
Member

@TeunHuijben awesome, feel free to merge whenever you're ready

@TeunHuijben
TeunHuijben merged commit 06b6796 into royerlab:main Aug 7, 2026
7 checks passed
@TeunHuijben
TeunHuijben deleted the fix-metadata-loss branch August 7, 2026 19:08
TeunHuijben added a commit to TeunHuijben/tracksdata that referenced this pull request Aug 8, 2026
* fix metadata loss in to_geff

* merge two io/geff files into 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants