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

Branch Graph Version 2 #191

Closed maarzt closed 1 year ago

maarzt commented 1 year ago

Implements the branch graph version 2 as suggested in #189. This PR depends on this PR https://github.com/mastodon-sc/mastodon-graph/pull/9.

Everything works nicely:

maarzt commented 1 year ago

Hello @tinevez,

This PR is now complete / ready to be merged from my side. I tested the color modes, some small fixes, and now it works.

I hope this PR can be part of the release. I'm currently implementing some small plugins for sorting the TrackScheme and automatically renaming the spots according to a nomenclature. These things naturally work well with the hierarchy TrackScheme, but there are small clitches caused by the current branch graph (version 1) definition. I'm confident, that using this branch graph v2 definition, will make things work out much smoother.

tinevez commented 1 year ago

There some kind of representation issue with linear branches. In the current scheme, a track made of a single branch (no division no fusion) will be represented by a lonely spot. Is there a way for the branches that represent this kind of track to be made of 2 spots (start and finish)? I realize by writing it that it is not easy nor elegant to do this.

tinevez commented 1 year ago

Here is an example of the issue I have on the Mette dataset (where lineages basically a binary tree):

image

1a21 is a track with no division, and is shown in the branch graph as a single vertex.

1a22 has a division at timepoint 18, then the 2 edges extend to frame 600. But in the branch graph the split is shown at frame 0, and the 2 edges extend to frame 18 and stop there.

maarzt commented 1 year ago

I fixed a part of the representation issue: The cell divisions are now rendered at the correct time points.

image

But the root nodes are still missing.

Is there a way for the branches that represent this kind of track to be made of 2 spots (start and finish)?

Getting the TrackSchemePanel to render two spots, where there is only one in the ModelBranchGraph is not easy. I couldn't find a solution today. But maybe it best to render the branch spot in some elongated fashion (a line form start to finish + a circle at the finish). We would need to add a "startTimePoint" to ScreenVertex and TrackSchemeVertex, and the classes LongEdgeLineageTreeLayout and PaintGraph would need to change.

maarzt commented 1 year ago

The last commit 303be33fa80a920fa3fe4cf05f2431165f71afd8 is again a bug fix, that you may also cherry pick.

maarzt commented 1 year ago

Hello @tinevez, I added two commits today. The rendering of the Branch TrackScheme is fixed. It works really well now. Additionally the labels are rendered correctly and selecting a BranchSpot in the Branch TrackScheme works better than ever. Please give it a try. Here's a screen shot:

image

maarzt commented 1 year ago

I rebased and cleaned this PR. It is now up to date with the current "dev" branch. Additionally, the commits have been sorted. The first four commits are simple refactorings and cleanups. The next two are bug fixes. The remaining 5 commits update the code to use BranchGraphV2.

The PR may now be ready to merge?

(Except what I would like to do is update the original BranchGaph and BranchGraphImp classes from V1 to V2. And remove the ugly names BranchGraphV2 and BranchGraphV2Imp. This of course should only be done if we don't decide to keep the original BranchGraph unchanged.)