funkelab / motile_toolbox

A toolbox for tracking with motile, including constructing candidate graphs and computing common features.
https://funkelab.github.io/motile_toolbox/
4 stars 0 forks source link

Include phase cross correlation flow #10

Open lmanan opened 2 months ago

lmanan commented 2 months ago

Proposed Change

This PR primarily includes calculation of flow by phase cross correlation and corrects the edge distance feature by incorporating the now available flow. It is designed to be used as follows:

from motile_toolbox.candidate_graph.compute_graph import get_candidate_graph
from motile_toolbox.utils.flow import compute_pcc_flow, correct_edge_distance

# Load segmentation and raw image data
segmentation = ...
raw = ...

# Create candidate graph, initially ignoring flow
candidate_graph, conflict_ids = get_candidate_graph(segmentation=segmentation,
                                                    max_edge_distance=50,
                                                    iou= True)

# Calculate phase cross correlation flow 
compute_pcc_flow(candidate_graph, images=raw)

# Correct previously calculated edge distance 
candidate_graph = correct_edge_distance(candidate_graph)

#  Execute motile-related commands, as usual
track_graph = TrackGraph(candidate_graph)
...

By calculating the flow separately and after constructing the candidate graph, allows the flexibility to replace this step by a flow coming from an alternate source (for example, a DL model).

Checklist

Go through these things before merge. Actions should run automatically to test them, but for information on how to run locally, see CONTRIBUTING.md.

Further Comments

Other minor changes include:

  1. Specifying the python version to be 3.10 onwards (f75e60d5e3ce829cf38b4f09a95d5b39f2748297) since the typing does not work for versions below.
  2. Obtaining motile from the github (6c27a49743524530421ec2092d1f1af5329bdf1d).
  3. Adding BBOX and FLOW by default (210371fadeab6d25b66bf96347b03f323996cff0).
codecov-commenter commented 1 month ago

Codecov Report

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

Project coverage is 77.13%. Comparing base (4221b06) to head (570c976). Report is 1 commits behind head on main.

Files Patch % Lines
src/motile_toolbox/utils/flow.py 0.00% 27 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #10 +/- ## ========================================== - Coverage 83.83% 77.13% -6.71% ========================================== Files 12 13 +1 Lines 297 328 +31 ========================================== + Hits 249 253 +4 - Misses 48 75 +27 ```

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