Skip to content

Commit 7fb432d

Browse files
committed
LineageRegistration: add javadoc
1 parent 5cce342 commit 7fb432d

4 files changed

Lines changed: 54 additions & 4 deletions

File tree

src/main/java/org/mastodon/mamut/tomancak/lineage_registration/LineageRegistrationControlService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
import org.scijava.plugin.Plugin;
1919
import org.scijava.service.AbstractService;
2020

21+
/**
22+
* This class is the controller for the {@link LineageRegistrationDialog}.
23+
* It shows the dialog and performs the actions requested by the user.
24+
* <p>
25+
* There should be only one instance of this class in the Fiji application.
26+
* This is ensured by making it an {@link ImageJService}. Being a service,
27+
* allows the {@link LineageRegistrationPlugin} to access it, and to call
28+
* {@link #registerMastodonInstance(WindowManager)}.
29+
*
30+
* @author Matthias Arzt
31+
*/
2132
@Plugin( type = ImageJService.class )
2233
public class LineageRegistrationControlService extends AbstractService implements ImageJService
2334
{

src/main/java/org/mastodon/mamut/tomancak/lineage_registration/LineageRegistrationDialog.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
import org.mastodon.mamut.WindowManager;
2323
import org.mastodon.mamut.project.MamutProject;
2424

25+
/**
26+
* Dialog for the {@link LineageRegistrationPlugin}. It allows to select two
27+
* {@link MamutProject}s and to perform various actions on them.
28+
*/
2529
public class LineageRegistrationDialog extends JDialog
2630
{
2731
private static final String SORT_TRACKSCHEME_TOOLTIP = "<html><body>"

src/main/java/org/mastodon/mamut/tomancak/lineage_registration/LineageRegistrationPlugin.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import org.scijava.ui.behaviour.util.RunnableAction;
2222

2323
/**
24-
* Shows the {@link LineageRegistrationDialog} and
25-
* executes the {@link LineageRegistrationAlgorithm} when
26-
* ok is clicked.
24+
* A plugin that registers the cell lineages of two stereotypically developing.
25+
* <p>
26+
* The plugin interacts with the {@link LineageRegistrationControlService} to
27+
* register the {@link MamutPluginAppModel} and tho show the {@link LineageRegistrationDialog}.
2728
*/
2829
@Plugin( type = MamutPlugin.class )
2930
public class LineageRegistrationPlugin implements MamutPlugin

src/main/java/org/mastodon/mamut/tomancak/lineage_registration/LineageRegistrationUtils.java

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,32 @@
2121
import org.mastodon.model.tag.ObjTagMap;
2222
import org.mastodon.model.tag.TagSetStructure;
2323

24+
/**
25+
* Utility class that implements most of the functionality
26+
* provided by the {@link LineageRegistrationPlugin}.
27+
*/
2428
public class LineageRegistrationUtils
2529
{
2630

31+
/**
32+
* Sorts the descendants in the second {@link ModelGraph} to match the order
33+
* of the descendants in the first {@link ModelGraph}.
34+
* The sorting is based on the result of the
35+
* {@link LineageRegistrationAlgorithm}.
36+
*/
2737
public static void sortSecondTrackSchemeToMatch( Model modelA, Model modelB )
2838
{
2939
RegisteredGraphs result = LineageRegistrationAlgorithm.run( modelA.getGraph(), modelB.getGraph() );
30-
FlipDescendants.flipDescendants( modelB, getSpotsToFlipB( result ) );
40+
RefList< Spot > spotsToFlipB = getSpotsToFlipB( result );
41+
FlipDescendants.flipDescendants( modelB, spotsToFlipB );
3142
}
3243

44+
/**
45+
* Copy a tag set from modelA to modelB.
46+
* The {@link LineageRegistrationAlgorithm} is used to find the matching
47+
* between the branches in modelA and modelB. The tags are copied from
48+
* the branches in modelA to the corresponding branches in modelB.
49+
*/
3350
public static TagSetStructure.TagSet copyTagSetToSecond( Model modelA, Model modelB,
3451
TagSetStructure.TagSet tagSetModelA, String newTagSetName )
3552
{
@@ -116,6 +133,10 @@ private static Function< TagSetStructure.Tag, TagSetStructure.Tag > getTagMap( T
116133
return map::get;
117134
}
118135

136+
/**
137+
* Creates a new tag set in both models. It runs the {@link LineageRegistrationAlgorithm}
138+
* and tags unmatched and flipped cells / branches.
139+
*/
119140
public static void tagCells( Model modelA, Model modelB, boolean modifyA, boolean modifyB )
120141
{
121142
RegisteredGraphs result = LineageRegistrationAlgorithm.run( modelA.getGraph(), modelB.getGraph() );
@@ -146,6 +167,10 @@ private static RefList< Spot > getSpotsToFlipB( RegisteredGraphs result )
146167
return getSpotsToFlipA( result.swapAB() );
147168
}
148169

170+
/**
171+
* Returns the spots in graph A that need to be flipped in order for the
172+
* descendants of graph A to match the order of the descendants in graph B.
173+
*/
149174
public static RefList< Spot > getSpotsToFlipA( RegisteredGraphs r )
150175
{
151176
Spot refA = r.graphA.vertexRef();
@@ -172,6 +197,11 @@ public static RefList< Spot > getSpotsToFlipA( RegisteredGraphs r )
172197
}
173198
}
174199

200+
/**
201+
* Returns true if the descendants of dividingA are in the opposite order
202+
* to the descendants of dividingB. Which descendant corresponds to which
203+
* is determined by the mapping {@link RegisteredGraphs#mapAB}.
204+
*/
175205
private static boolean doesRequireFlip( RegisteredGraphs r, Spot dividingA, Spot dividingB )
176206
{
177207
Spot refA = r.graphA.vertexRef();
@@ -195,6 +225,10 @@ private static boolean doesRequireFlip( RegisteredGraphs r, Spot dividingA, Spot
195225
}
196226
}
197227

228+
/**
229+
* Returns a list of branch starts in graph A that are not mapped to any
230+
* branch in graph B.
231+
*/
198232
public static RefSet< Spot > getUnmatchSpotsA( RegisteredGraphs r )
199233
{
200234
RefSet< Spot > branchStarts = BranchGraphUtils.getAllBranchStarts( r.graphA );

0 commit comments

Comments
 (0)