quantumjot / btrack

Bayesian multi-object tracking
https://btrack.readthedocs.io
MIT License
310 stars 50 forks source link

Add writer to plugin for exporting a Tracks layer to hdf #369

Closed p-j-smith closed 11 months ago

p-j-smith commented 11 months ago

Part of #266

https://github.com/quantumjot/btrack/assets/29753790/1f64c4ea-aeb9-44b7-b9e8-f83fe4095311

deprecated-napari-hub-preview-bot[bot] commented 11 months ago

Preview page for your plugin is ready here: https://preview.napari-hub.org/quantumjot/btrack/369 Updated: 2023-08-08T13:14:32.448529

codecov-commenter commented 11 months ago

Codecov Report

Patch coverage: 71.15% and project coverage change: -0.33% :warning:

Comparison is base (009622b) 85.91% compared to head (817a73e) 85.58%. Report is 3 commits behind head on main.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #369 +/- ## ========================================== - Coverage 85.91% 85.58% -0.33% ========================================== Files 30 31 +1 Lines 2172 2192 +20 Branches 396 402 +6 ========================================== + Hits 1866 1876 +10 - Misses 225 233 +8 - Partials 81 83 +2 ``` | [Files Changed](https://app.codecov.io/gh/quantumjot/btrack/pull/369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe) | Coverage Δ | | |---|---|---| | [btrack/napari/writer.py](https://app.codecov.io/gh/quantumjot/btrack/pull/369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL25hcGFyaS93cml0ZXIucHk=) | `0.00% <0.00%> (ø)` | | | [btrack/utils.py](https://app.codecov.io/gh/quantumjot/btrack/pull/369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL3V0aWxzLnB5) | `83.83% <79.31%> (-1.17%)` | :arrow_down: | | [btrack/constants.py](https://app.codecov.io/gh/quantumjot/btrack/pull/369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2NvbnN0YW50cy5weQ==) | `100.00% <100.00%> (ø)` | | | [btrack/datasets.py](https://app.codecov.io/gh/quantumjot/btrack/pull/369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL2RhdGFzZXRzLnB5) | `86.84% <100.00%> (+1.99%)` | :arrow_up: | | [btrack/napari/reader.py](https://app.codecov.io/gh/quantumjot/btrack/pull/369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe#diff-YnRyYWNrL25hcGFyaS9yZWFkZXIucHk=) | `75.00% <100.00%> (+1.66%)` | :arrow_up: | ... and [8 files with indirect coverage changes](https://app.codecov.io/gh/quantumjot/btrack/pull/369/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alan+R+Lowe)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

p-j-smith commented 11 months ago

Is the plan to also have the box underneath or not? https://github.com/quantumjot/btrack/issues/266#issuecomment-1480162405

I think this is the typical way of creating writers for napari, but we could do - it might make it more obvious to users that the writer exists!

p-j-smith commented 11 months ago

The tracks look the same once loaded back into napari, but I haven't yet checked that all attributes of the layers are identical

I've now checked the attributes of the tracks by loading the sample dataset and doing:

data, properties, graph = tracks_to_napari(tracks)
new_tracks = napari_to_tracks(data, properties, graph)

The only difference is in the track.z values. The tracks are 2D, and when the napari layer is created the z values are lost. But the dummy objects in the original tracks have non-zero z values. Otherwise everything looks okay!

paddyroddy commented 11 months ago

I've now checked the attributes of the tracks by loading the sample dataset and doing:

data, properties, graph = tracks_to_napari(tracks)
new_tracks = napari_to_tracks(data, properties, graph)

Do/could we have a test for this?

p-j-smith commented 11 months ago

Do/could we have a test for this?

Good idea - it made me realise I wasn't setting the generation correctly