Skip to content

segmentation_shape metadata reformat - #260

Open
TeunHuijben wants to merge 8 commits into
mainfrom
fix-segmentation-shape
Open

segmentation_shape metadata reformat#260
TeunHuijben wants to merge 8 commits into
mainfrom
fix-segmentation-shape

Conversation

@TeunHuijben

@TeunHuijben TeunHuijben commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

connected to: funkelab/motile_tracker#459

Problem:

  • tracksdata saves segmentation shape in geffmetadata as .extra.tracksdata.shape
  • funtracks/motile_tracker save segmentation shape in zarr-metadata as segmentation_shape at the top level (outside the geff metadata)
  • in retrospect, the latter is not the smartest design decision, because 1) top-level non-geff metadata doesn't survive round-trips, and 2) it is inconsistent with tracksdata

Solution:
This PR removes the segmentation_shape logic, and fully uses the existing tracksdata format of saving the shape in metadata.extra.tracksdata.shape. When reading the shape from the metadata we do a double check for backwards compatibility.

For geffs that are exported from motile_tracker and then imported, it doesn't matter where we save the shape, because that is an internal discussion. But for geffs exported by other tracksdata-based tracking tools (ultrack, hoct, etc.), we are now natively compatible.

I will implement the accompanying changes in motile_tracker in a separate PR there

@TeunHuijben
TeunHuijben requested a review from cmalinmayor as a code owner July 24, 2026 23:13
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.91%. Comparing base (be685db) to head (2979b33).

Files with missing lines Patch % Lines
src/funtracks/import_export/geff/_import.py 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
- Coverage   93.92%   93.91%   -0.01%     
==========================================
  Files          59       59              
  Lines        3323     3322       -1     
==========================================
- Hits         3121     3120       -1     
  Misses        202      202              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TeunHuijben
TeunHuijben force-pushed the fix-segmentation-shape branch from 204388f to c0af650 Compare July 27, 2026 19:37
@TeunHuijben TeunHuijben added the blocked PR blocked by something else label Jul 27, 2026
@TeunHuijben TeunHuijben removed the blocked PR blocked by something else label Jul 28, 2026
@cmalinmayor

Copy link
Copy Markdown
Contributor

Can we add an API in tracksdata for saving and loading segmentation metadata (shape and voxel size?). Then, we don't need to depend on internal tracksdata implementation details, and tracksdata can change where this info is stored at any time.

@TeunHuijben

TeunHuijben commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @cmalinmayor, good point! I made the following changes:

  • tracksdata .to_geff is updated to automatically save the tracksdata metadata within the geff metadata, so we don't need to do that separately anymore
  • tracksdata shape api has been changed, so we can now just read/write graph.metadata["shape"], without needing to know how td that exactly saved in the metadata
  • a new tracksdata io helper allows reading the segmenation shape from a geff store, before loading the graph. So all of this allows us read/write/see the shape, from a surface level point of view

Some other changes along the way:

  • small change to the benchmark to run them on 1 machine, for fair comparison
  • some skips in the tests_old, because they were dependend on segmentation_shape not segmentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for initial review PR ready for first review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants