royerlab / ultrack

Cell tracking and segmentation software
https://royerlab.github.io/ultrack
BSD 3-Clause "New" or "Revised" License
64 stars 7 forks source link

Bug fix and improvement in TrackMate export #90

Closed qin-yu closed 4 months ago

qin-yu commented 4 months ago

Hey @JoOkuma,

@tischi and I encountered a small but critical and elusive bug, fixed by this PR.

image

Fig. 1. TrackMate. Before: no tracks | After: tracks | After: details

image

Fig. 2. Mastodon. After: tracks and details

The current test for exporting tracks to TrackMate solely verifies the inclusion of all spots in the output, neglecting tracking semantics. In this PR, I choose not to implement an additional test that merely converts the XML back, since the essential validation comes from the actual opening and viewing of successful tracks. I revised the function's name, though I suspect it has not been used for a while.

Before Fix

TrackMate launches with error:

Some errors occurred while reading file:

Unknown spot ID: 2000008
Could not find the detector element in file.
Could not find the tracker element in file.
Could not find the feature analyzer element.
Could not find the display-settings element. Returning user defaults.

Mastodon throws error only:

Exception in thread "Thread-8" java.lang.NullPointerException
    at org.mastodon.mamut.io.importer.trackmate.TrackMateImporter$Import.<init>(TrackMateImporter.java:429)
    at org.mastodon.mamut.io.importer.trackmate.TrackMateImporter.readModel(TrackMateImporter.java:236)
    at org.mastodon.mamut.launcher.MastodonLauncher.lambda$importMaMuT$18(MastodonLauncher.java:504)
    at java.lang.Thread.run(Thread.java:748)
codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (main@09807e8). Click here to learn what that means.

Files Patch % Lines
ultrack/core/export/trackmate.py 71.42% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #90 +/- ## ======================================= Coverage ? 85.41% ======================================= Files ? 71 Lines ? 3916 Branches ? 0 ======================================= Hits ? 3345 Misses ? 571 Partials ? 0 ```

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

JoOkuma commented 4 months ago

LGTM! Thanks @qin-yu