funkelab / motile

Multi-Object Tracker using Integer Linear Equations
https://funkelab.github.io/motile/
MIT License
24 stars 5 forks source link

Add flow constraints #34

Open bentaculum opened 1 year ago

bentaculum commented 1 year ago

Adds two modular constraints necessary for a network flow formulation, useful for example for single particle tracking:

Each constraint includes a functional test.

codecov-commenter commented 1 year ago

Codecov Report

Merging #34 (53553f4) into main (dc797d4) will increase coverage by 0.32%. The diff coverage is 97.82%.

@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   92.47%   92.80%   +0.32%     
==========================================
  Files          30       32       +2     
  Lines         718      764      +46     
==========================================
+ Hits          664      709      +45     
- Misses         54       55       +1     
Files Changed Coverage Δ
motile/constraints/min_track_length.py 95.23% <95.23%> (ø)
motile/constraints/__init__.py 100.00% <100.00%> (ø)
motile/constraints/in_out_symmetry.py 100.00% <100.00%> (ø)
bentaculum commented 1 year ago

@funkey I am wondering what would be a nice way to generalize the MinTrackLength constraint to arbitrary length (currently only implemented for min_length=1, which is trivial). Is there a way around creating indicator variables for all possible tracks of min_length and coupling them to e.g. the edges?

funkey commented 1 year ago

I think you could introduce an integer variable for each edge that counts the number of edges since appear (a constraint needs to ensure that each edge's length integer has to be one more than the incoming one). Then you can add a constraint that only allows for disappear events to happen if the integer is greater equal a threshold. That should do it.