mastodon-sc / mastodon

Mastodon – a large-scale tracking and track-editing framework for large, multi-view images.
BSD 2-Clause "Simplified" License
66 stars 20 forks source link

Suggest Branch Graph Version 2 #189

Closed maarzt closed 1 year ago

maarzt commented 1 year ago

I think the branch graph functionality will be very important in Mastodon and I like it already very much. That's why I think will by very valuable to fix following problem now.

While playing around with the branch graph. I noticed that the branch graph always looks a bit different from what I expect from a biological point of view. Here is an example, I used a blue pen to draw an example for a tracking graph, and a red pen to draw the respective branch graph that mastodon generates:

Currently: Branch Graph Version 1

When I would describe what the blue graph shows it would go like this: "A cell divides into two cell, than they merge again, and then this cell divides again." (I know cells don't merge, but other objects tracked with mastodon might merge)

Please notice notice how the branch graph hardly tells this story. The initial cell is for some reasons represented by two nodes, than the first cell division is represented by two parallel edges. After merging we have again two nodes to represent one cell, and finally we see a clear cell division in the branch graph.

I know and understand how Mastodon calculates the branch graph. But I would like to make the point, that the resulting branch graph is hard to understand from a Biological point of view.

I would therefor suggest to change how the branch graph is defined and calculated in Mastodon. Here is my suggestion:

Suggestion: Branch Graph Version 2

The nodes in the "branch graph version 2" represent a cell / spot that moves over time without dividing or merging. The edges in the "branch graph version 2" represent cell division or merging events.

Advantages of version 2:

Disadvantages of version 2:

maarzt commented 1 year ago

@tinevez What do you think?

tinevez commented 1 year ago

Thanks for this suggestion!

Yes you are right the v2 shows better the biology. But for now, I would be in favor of keeping the version 1 of the model, mainly because of the amount of work to get it right again. Also because we do not have many applications of the loops in Biology. (Do we?).

What about we address the issue by working on the TrackScheme display of loops instead?

maarzt commented 1 year ago

I know, it was already a lot of work that went into the current status of the branch graph. I'm actually impressed how fast it got done. There were quite some hurdles on the way, I remember the problem with Mette's data, that led to the retirement of the incremental branch graph. But I actually think implementing this branch graph V2 is quite doable, branch graph V1 already shows how to do it all. Only minor parts need to be changed.

I already have a BranchGraphV2Imp implementation (My inner nerd likes algorithms and data structures). Next step would be to update the branch graph UI. I'm optimistic that I could setup a PR that gets things 95% right till the end of the week.

tinevez commented 1 year ago

Woah! Ok then let's go. Do you need RW access to the mastodon-graph-repo?

maarzt commented 1 year ago

Great. I can push already to mastodon-graph. I think Tobi added me as a member to the mastodon-sc organization.

maarzt commented 1 year ago

Hi @tinevez, I created two PRs that address this issue. It works well, except for the graph coloring with respect to branch graph, that's something that still needs to be fixed. But maybe that's a piece of :cake: for you? I don't yet understand the graph coloring well enough to fix it.

And I will be on vacation till September 6.