Skip to content

Commit

Permalink
Merge pull request #63 from mastodon-sc/rename-lineage-registration
Browse files Browse the repository at this point in the history
Rename Lineage Registration to Spatial Track Matching
  • Loading branch information
maarzt authored Oct 9, 2024
2 parents e673b34 + 5eff8bd commit ab32a22
Show file tree
Hide file tree
Showing 46 changed files with 130 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.mastodon.mamut.model.Link;
import org.mastodon.mamut.model.ModelGraph;
import org.mastodon.mamut.model.Spot;
import org.mastodon.mamut.tomancak.lineage_registration.BranchGraphUtils;
import org.mastodon.mamut.tomancak.trackmatching.BranchGraphUtils;

/**
* A sorting "order" for sorting the lineage tree in a {@link ModelGraph}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import net.imglib2.util.Pair;
import net.imglib2.util.ValuePair;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

/**
* Similar to {@link AutoCloseable}, but without the checked exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.awt.Component;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.util.function.Predicate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.util.concurrent.locks.Lock;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.util.function.Predicate;
import java.util.function.UnaryOperator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.util.function.BiConsumer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import org.mastodon.RefPool;
import org.mastodon.collection.RefDoubleMap;
Expand All @@ -36,15 +36,15 @@
import org.mastodon.mamut.model.Model;
import org.mastodon.mamut.model.ModelGraph;
import org.mastodon.mamut.model.Spot;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.InverseSpatialRegistration;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.SpatialRegistration;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.InverseSpatialRegistration;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.SpatialRegistration;

/**
* <p>
* This datastructure holds two {@link ModelGraph}s and a mapping between them.
* </p>
* <p>
* This is also the return type of {@link LineageRegistrationAlgorithm#run}.
* This is also the return type of {@link SpatialTrackMatchingAlgorithm#run}.
* </p>
*/
public class RegisteredGraphs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.util.HashSet;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import org.mastodon.mamut.ProjectModel;
import org.mastodon.mamut.model.Model;
import org.mastodon.mamut.model.ModelGraph;

/**
* Used in {@link LineageRegistrationFrame} and {@link LineageRegistrationControlService}
* Used in {@link SpatialTrackMatchingFrame} and {@link SpatialTrackMatchingControlService}
* to exchange information about the selected projects and related sittings.
*/
public class SelectedProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import net.imglib2.realtransform.AffineTransform3D;

Expand All @@ -37,10 +37,10 @@
import org.mastodon.mamut.model.Model;
import org.mastodon.mamut.model.ModelGraph;
import org.mastodon.mamut.model.Spot;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.NotEnoughPairedRootsException;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.SpatialRegistration;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.SpatialRegistrationFactory;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.SpatialRegistrationMethod;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.NotEnoughPairedRootsException;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.SpatialRegistration;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.SpatialRegistrationFactory;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.SpatialRegistrationMethod;
import org.mastodon.mamut.tomancak.sort_tree.SortTreeUtils;

/**
Expand All @@ -50,7 +50,7 @@
*
* @see SortTreeUtils#directionOfCellDevision(ModelGraph, Spot)
*/
public class LineageRegistrationAlgorithm
public class SpatialTrackMatchingAlgorithm
{
private static final int TIME_OFFSET = SortTreeUtils.DIVISION_DIRECTION_TIME_OFFSET;

Expand All @@ -71,7 +71,7 @@ public class LineageRegistrationAlgorithm
private final RefDoubleMap< Spot > angles;

/**
* Runs the lineage registration algorithm for to given graphs. The spots before
* Runs the spatial track matching for to given graphs. The spots before
* the given timepoints are ignored.
*
* @return a {@link RegisteredGraphs} object that contains the two graphs and the
Expand Down Expand Up @@ -117,7 +117,7 @@ private static NotEnoughPairedRootsException newDetailedNotEnoughPairedRootsExce
public static RegisteredGraphs run( Model modelA, Model modelB,
RefRefMap< Spot, Spot > roots, SpatialRegistration spatialRegistration )
{
LineageRegistrationAlgorithm algorithm = new LineageRegistrationAlgorithm(
SpatialTrackMatchingAlgorithm algorithm = new SpatialTrackMatchingAlgorithm(
modelA.getGraph(), modelB.getGraph(),
roots, spatialRegistration );
return new RegisteredGraphs( modelA, modelB, spatialRegistration, algorithm.getMapping(), algorithm.getAngles() );
Expand All @@ -128,7 +128,7 @@ private RefDoubleMap< Spot > getAngles()
return angles;
}

private LineageRegistrationAlgorithm( ModelGraph graphA, ModelGraph graphB, RefRefMap< Spot, Spot > roots,
private SpatialTrackMatchingAlgorithm( ModelGraph graphA, ModelGraph graphB, RefRefMap< Spot, Spot > roots,
SpatialRegistration spatialRegistration )
{
this.spatialRegistration = spatialRegistration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -41,27 +41,27 @@
import org.mastodon.mamut.ProjectModel;
import org.mastodon.mamut.model.Model;
import org.mastodon.mamut.model.Spot;
import org.mastodon.mamut.tomancak.lineage_registration.angle_feature.CellDivisionAngleFeature;
import org.mastodon.mamut.tomancak.lineage_registration.coupling.ModelCoupling;
import org.mastodon.mamut.tomancak.trackmatching.angle_feature.CellDivisionAngleFeature;
import org.mastodon.mamut.tomancak.trackmatching.coupling.ModelCoupling;
import org.mastodon.model.tag.TagSetStructure;
import org.scijava.plugin.Plugin;
import org.scijava.service.AbstractService;

/**
* This class is the controller for the {@link LineageRegistrationFrame}.
* This class is the controller for the {@link SpatialTrackMatchingFrame}.
* It shows the dialog and performs the actions requested by the user.
* <p>
* There should be only one instance of this class in the Fiji application.
* This is ensured by making it an {@link ImageJService}. Being a service,
* allows the {@link LineageRegistrationPlugin} to access it, and to call
* allows the {@link SpatialTrackMatchingPlugin} to access it, and to call
* {@link #registerMastodonInstance}.
*
* @author Matthias Arzt
*/
@Plugin( type = ImageJService.class )
public class LineageRegistrationControlService extends AbstractService implements ImageJService
public class SpatialTrackMatchingControlService extends AbstractService implements ImageJService
{
private LineageRegistrationFrame dialog = null;
private SpatialTrackMatchingFrame dialog = null;

private final List< ProjectModel > projectModels = new ArrayList<>();

Expand All @@ -87,7 +87,7 @@ public synchronized void showDialog()
return;
}
if ( dialog == null )
dialog = new LineageRegistrationFrame( new Listener() );
dialog = new SpatialTrackMatchingFrame( new Listener() );
dialog.setMastodonInstances( projectModels );
dialog.pack();
dialog.setVisible( true );
Expand All @@ -108,7 +108,7 @@ private static void executeTask( boolean writeLock, SelectedProject projectA, Se
} ).start();
}

private class Listener implements LineageRegistrationFrame.Listener
private class Listener implements SpatialTrackMatchingFrame.Listener
{

private ModelCoupling coupling = null;
Expand All @@ -132,7 +132,7 @@ private void sortSecondTrackScheme( SelectedProject project1, SelectedProject pr
dialog.log( "Sort the order of the child cells in the TrackScheme of project \"%s\".", project1.getName() );
dialog.log( "Use project \"%s\" as reference...", project2.getName() );
RegisteredGraphs registration = runRegistrationAlgorithm( project1, project2 );
LineageRegistrationUtils.sortSecondTrackSchemeToMatch( registration );
SpatialTrackMatchingUtils.sortSecondTrackSchemeToMatch( registration );
project2.getProjectModel().getBranchGraphSync().sync();
project2.getModel().setUndoPoint();
dialog.log( "done." );
Expand All @@ -148,7 +148,7 @@ public void onColorLineagesClicked()
dialog.clearLog();
dialog.log( "Create tag set \"lineages\" in project \"%s\"...", projectA.getName() );
dialog.log( "Create tag set \"lineages\" in project \"%s\"...", projectB.getName() );
LineageColoring.tagLineages(
TrackColoring.tagLineages(
projectA.getModel(), projectA.getFirstTimepoint(),
projectB.getModel(), projectB.getFirstTimepoint() );
projectA.getModel().setUndoPoint();
Expand Down Expand Up @@ -176,7 +176,7 @@ private void copyLabelsFromTo( SelectedProject fromProject, SelectedProject toPr
dialog.log( "Copy labels from project \"%s\" to project \"%s\"...",
fromProject.getName(), toProject.getName() );
RegisteredGraphs registration = runRegistrationAlgorithm( fromProject, toProject );
LineageRegistrationUtils.copySpotLabelsFromAtoB( registration );
SpatialTrackMatchingUtils.copySpotLabelsFromAtoB( registration );
toProject.getModel().setUndoPoint();
dialog.log( "done." );
} );
Expand Down Expand Up @@ -222,7 +222,7 @@ private void copyTagSetFromTo( SelectedProject fromProject, SelectedProject toPr
tagSet.getName(), fromProject.getName(), toProject.getName() );
String newTagSetName = tagSet.getName() + " (" + fromProject.getName() + ")";
RegisteredGraphs registration = runRegistrationAlgorithm( fromProject, toProject );
LineageRegistrationUtils.copyTagSetToSecondModel( registration, tagSet, newTagSetName );
SpatialTrackMatchingUtils.copyTagSetToSecondModel( registration, tagSet, newTagSetName );
toModel.setUndoPoint();
dialog.log( "done." );
} );
Expand Down Expand Up @@ -253,11 +253,11 @@ private void putTags( boolean modifyA, boolean modifyB )
executeTask( false, projectA, projectB, () -> {
dialog.clearLog();
if ( modifyA )
dialog.log( "Create tag set \"lineage registration\" in project \"%s\"...", projectA.getName() );
dialog.log( "Create tag set \"spatial track matching\" in project \"%s\"...", projectA.getName() );
if ( modifyB )
dialog.log( "Create tag set \"lineage registration\" in project \"%s\"...", projectB.getName() );
dialog.log( "Create tag set \"spatial track matching\" in project \"%s\"...", projectB.getName() );
RegisteredGraphs registration = runRegistrationAlgorithm( projectA, projectB );
LineageRegistrationUtils.tagCells( registration, modifyA, modifyB );
SpatialTrackMatchingUtils.tagCells( registration, modifyA, modifyB );
if ( modifyA )
projectA.getModel().setUndoPoint();
if ( modifyB )
Expand Down Expand Up @@ -299,7 +299,7 @@ public void onPlotAnglesClicked()
SelectedProject projectB = dialog.getProjectB();
RegisteredGraphs registeredGraphs = runRegistrationAlgorithm( projectA, projectB );
RefDoubleMap< Spot > anglesA = registeredGraphs.anglesA;
LineageRegistrationUtils.plotAngleAgainstTimepoint( anglesA );
SpatialTrackMatchingUtils.plotAngleAgainstTimepoint( anglesA );
}

@Override
Expand All @@ -316,7 +316,7 @@ public void onAddAnglesFeatureClicked()

private RegisteredGraphs runRegistrationAlgorithm( SelectedProject projectA, SelectedProject projectB )
{
return LineageRegistrationAlgorithm.run(
return SpatialTrackMatchingAlgorithm.run(
projectA.getModel(), projectA.getFirstTimepoint(),
projectB.getModel(), projectB.getFirstTimepoint(),
dialog.getSpatialRegistrationMethod() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package org.mastodon.mamut.tomancak.lineage_registration;
package org.mastodon.mamut.tomancak.trackmatching;

import java.text.NumberFormat;
import java.util.ArrayList;
Expand All @@ -52,13 +52,13 @@
import org.mastodon.app.ui.GroupLocksPanel;
import org.mastodon.mamut.ProjectModel;
import org.mastodon.mamut.io.project.MamutProject;
import org.mastodon.mamut.tomancak.lineage_registration.spatial_registration.SpatialRegistrationMethod;
import org.mastodon.mamut.tomancak.trackmatching.spatial_registration.SpatialRegistrationMethod;

/**
* Dialog for the {@link LineageRegistrationPlugin}. It allows to select two
* Dialog for the {@link SpatialTrackMatchingPlugin}. It allows to select two
* {@link MamutProject}s and to perform various actions on them.
*/
public class LineageRegistrationFrame extends JFrame
public class SpatialTrackMatchingFrame extends JFrame
{
private static final String FIRST_TIMEPOINT_TOOLTIP = "<html><body>"
+ "The first time point of a project to be used for the registration.<br>"
Expand All @@ -75,7 +75,7 @@ public class LineageRegistrationFrame extends JFrame
+ "</body></html>";

private static final String TAG_CELLS_TOOLTIP = "<html><body>"
+ "<b>Creates a new tag set \"lineage registration\" in the selected project.</b><br>"
+ "<b>Creates a new tag set \"spatial track matching\" in the selected project.</b><br>"
+ "<br>"
+ "The tag set contains two tags:"
+ "<ul>"
Expand Down Expand Up @@ -148,9 +148,9 @@ public class LineageRegistrationFrame extends JFrame

private final JTextArea logArea;

public LineageRegistrationFrame( Listener listener )
public SpatialTrackMatchingFrame( Listener listener )
{
super( "Lineage Registration Across Two Mastodon Projects" );
super( "Spatial Track Matching Across Two Mastodon Projects" );
this.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
this.setLocationByPlatform( true );
this.listener = listener;
Expand Down Expand Up @@ -265,7 +265,7 @@ private JButton newOperationButton( String title, String hint, Runnable action )
private static JTextPane introductionTextPane()
{
final String introText = "<html><body>"
+ "The \"lineage registration\" plugin allows comparing the lineages of two "
+ "The \"spatial track matching\" plugin allows comparing the lineages of two "
+ "similarly developing embryos in two Mastodon projects. By analyzing the "
+ "spindle directions it finds the corresponding cells in both embryos."
+ "<br><br>"
Expand All @@ -277,10 +277,10 @@ private static JTextPane introductionTextPane()
+ "<li>Both projects should show stereotypically developing embryos.</li>"
+ "<li>The first frames should show both the embryos at a similar developmental stage.</li>"
+ "<li>Root nodes must be labeled, and the labels should match between the two projects.</li>"
+ "<li>There needs to be at least three lineages with cell divisions, "
+ "<li>There needs to be at least three tracks with cell divisions, "
+ "that can be paired based on their names.</li>"
+ "</ul>"
+ "(Note: The plugin ignores lineages that have no cell divisions.)<br><br>"
+ "(Note: The plugin ignores tracks that have no cell divisions.)<br><br>"
+ "</body></html>";
JTextPane comp = new JTextPane();
comp.setContentType( "text/html" );
Expand Down Expand Up @@ -528,7 +528,7 @@ public void onAddAnglesFeatureClicked()
public static void main( String... args )
{
// NOTE: Small demo function that only shows the LineageRegistrationDialog. For easy debugging.
LineageRegistrationFrame dialog = new LineageRegistrationFrame( new DummyListener() );
SpatialTrackMatchingFrame dialog = new SpatialTrackMatchingFrame( new DummyListener() );
dialog.pack();
dialog.setVisible( true );
}
Expand Down
Loading

0 comments on commit ab32a22

Please sign in to comment.