Skip to content

Commit

Permalink
Add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
maarzt committed Jun 27, 2024
1 parent 28948e6 commit bfaef38
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,26 @@
import gnu.trove.set.TIntSet;
import gnu.trove.set.hash.TIntHashSet;

/**
* Class that holds the code for creating a conflict tag set. Uses
* {@link HellingerDistance} to figure out which spots overlap
* significantly.
*/
public class CreateConflictTagSet
{
/**
* Add a new tag set to the model, with all conflicts between spots tagged.
* A conflict is defined as two spots whose Hellinger distance is less than the
* threshold.
*
* @param model the model that contains the spot graph and to which the tag set
* will be added.
* @param tagSetName the name of the tag set to be created.
* @param threshold the Hellinger distance threshold. Two spot are considered in
* conflict if their Hellinger distance is less than or equal to
* this value.
* @return the tag set that was created.
*/
public static TagSetStructure.TagSet run( final Model model, final String tagSetName, final double threshold )
{
final ModelGraph graph = model.getGraph();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

/**
* The GUI command to create a conflict tag set.
*/
@Plugin( type = Command.class, name = "Create Conflict Tag Set" )
public class CreateConflictTagSetCommand extends DefaultCancelable implements Command
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package org.mastodon.mamut.tomancak.resolve;

import java.util.Collection;

import org.mastodon.mamut.model.Model;
import org.mastodon.mamut.model.Spot;

/**
* Exception that is thrown by {@link FuseSpots#run(Model, Collection, Spot)} whenever
* the set of spots don't fulfill the very specific requirements of the algorithm. The
* exception is meant to be caught and communicated to the user.
*/
public class FuseSpotSelectionException extends RuntimeException
{
public FuseSpotSelectionException()
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/org/mastodon/mamut/tomancak/resolve/FuseSpots.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@
import org.mastodon.model.tag.TagSetModel;
import org.mastodon.model.tag.TagSetStructure;

/**
* Code for fusing spots in a {@link ProjectModel}.
*/
public class FuseSpots
{

/**
* Run the "fuse spots" operation on the specified {@link ProjectModel}.
* <br>
* The currently selected spots are fused into a single track. For
* each timepoint, the position and covariance of the selected spots
* are averaged. And assigned to a fused spot.
* <br>
* This method is meant to be called from the GUI. It takes care of
* setting locks, undo points, and notifying listeners. Message dialogs
* are shown in case of errors.
*/
public static void run( final ProjectModel projectModel ) {
final Model model = projectModel.getModel();
final ModelGraph graph = projectModel.getModel().getGraph();
Expand Down Expand Up @@ -63,6 +77,19 @@ public static void run( final ProjectModel projectModel ) {
}
}

/**
* Fuse the specified spots into a single track.
* <p>
* This method is independent of the GUI and can be used in other contexts.
* @param model the model to operate on. The graph is modified, some spots and links
* are removed. New edges are added, and the tags of the new edges are
* set.
* @param spots the set of spots to fuse.
* @param focus this selected spots that are connected to this spot are kept. Their
* position and covariance are updated.
*
* @see #run(ProjectModel)
*/
public static void run( final Model model, final Collection< Spot > spots, final Spot focus )
{
final ModelGraph graph = model.getGraph();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@

import org.mastodon.mamut.model.Spot;

/**
* Compute the Hellinger distance.
*/
public class HellingerDistance
{
/**
* @return The Hellinger distance of the two gaussian distributions associated
* with the two specified spots. The distance is in [0,1], where 0 means the
* two spots are identical, and 1 means they are completely different.
* <br>
* The Hellinger distance can be used as an indicator of roughly how much two
* spots overlap.
*/
public static double hellingerDistance( final Spot a, final Spot b )
{
return hellingerDistance( a.positionAsDoubleArray(), covariance( a ), b.positionAsDoubleArray(), covariance( b ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
import org.mastodon.model.tag.TagSetModel;
import org.mastodon.model.tag.TagSetStructure;

/**
* Shows a window with a list of locations where the tags of a given tag set are
* found in the tracking data. The user can select a location in the list and
* the linked views will navigate to the corresponding spot.
* <br>
* Additionally, the selection of locations in the list will be reflected in the
* selection of spots. And tags can be removed from the selected spots.
*/
public class LocateTagsFrame extends JFrame
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@
import org.mastodon.model.tag.TagSetModel;
import org.mastodon.model.tag.TagSetStructure;

/**
* Class for removing a "connected component of tags" from a model.
*/
public class RemoveTagComponents
{
/**
* For the given tag set remove the tag from the given spots and all the
* spots that are connected to them by edges and have the same tag. The
* tag for connected edges is also removed.
*/
public static void run( final ProjectModel projectModel, final TagSetStructure.TagSet tagSet, final Collection< Spot > spots )
{
final Model model = projectModel.getModel();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/mastodon/mamut/tomancak/util/Glasbey.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class Glasbey

/**
* Returns a color supplier for light Glasbey colors.
* <p>
* <br>
* Each call to {@link IntSupplier#getAsInt()} returns the next color from the table.
* The table contains 256 different colors, which are repeated if the supplier is
* called more than 256 times. The colors are meant to be distinguishable from each
* other. All colors are light colors, they have gut contrast to black background
* other. All colors are light colors, they have good contrast to black background
* or text.
*/
public static IntSupplier getGlasbeyLightColorSupplier()
Expand Down

0 comments on commit bfaef38

Please sign in to comment.