Fix starting new track_id by pressing 'M'#96
Conversation
…cksLabels layer, which should assign a color for the next available node id
… or smaller than the max value in the array
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #96 +/- ##
=======================================
Coverage 89.44% 89.44%
=======================================
Files 650 650
Lines 60169 60168 -1
=======================================
+ Hits 53817 53818 +1
+ Misses 6352 6350 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| new_selected_label = np.max(layer.data) + 1 | ||
| if layer.selected_label == new_selected_label: | ||
| if layer.selected_label > new_selected_label: | ||
| show_info( |
There was a problem hiding this comment.
Maybe just set new track ID here instead of setting a new label? I think regardless you need to set a new track ID as well as a new label.
There was a problem hiding this comment.
Yes I think indeed don't need the if statements at all and can just (re)assign the selected_label to np.max(layer.data) + 1 if it isn't already (because of ensure_valid_label) and create a new track_id and color for it.
…a) + 1 (if it is not already) and assign a new track_id and color
cmalinmayor
left a comment
There was a problem hiding this comment.
Excellent, I like it much more now! Thanks :)
Fix for issue #84 (hopefully)
Allow the user to start a new track by pressing M on the TracksLabels layer, which should assign a color for the next available node id and add it to the colormap.
Steps to test:
Notes:
You can assign a new node id by pressing M even if the max value +1 in the array is equal to the currently selected label. The ensure_valid_label function automatically adds +1 to the selected_label when moving in time to ensure that you can continue a track_id without having to select it each time you go to a different time point. If the currently assigned label is larger than the max value +1 in the array, we should not allow the user to add a new label, as they should use the current one first.