public class LAPUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
XML_ELEMENT_NAME_FEATURE_PENALTIES |
static String |
XML_ELEMENT_NAME_GAP_CLOSING |
static String |
XML_ELEMENT_NAME_LINKING |
static String |
XML_ELEMENT_NAME_MERGING |
static String |
XML_ELEMENT_NAME_SPLITTING |
| Constructor and Description |
|---|
LAPUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addFeaturePenaltyToSettings(Map<?,?> motherMap,
Object motherKey,
Object childKey,
Object childValue,
StringBuilder errorHolder)
Utility method to put a value in a map, contained in a mother map.
|
static boolean |
checkFeatureMap(Map<String,Object> map,
String featurePenaltiesKey,
StringBuilder errorHolder)
Check the validity of a feature penalty map in a settings map.
|
static boolean |
checkSettingsValidity(Map<String,Object> settings,
StringBuilder errorHolder) |
static double |
computeLinkingCostFor(Spot s0,
Spot s1,
double distanceCutOff,
double blockingValue,
Map<String,Double> featurePenalties)
Compute the cost to link two spots, in the default way for the TrackMate trackmate.
|
static void |
displayCostMatrix(double[][] costs,
int nSegments,
int nSpots,
double blockingValue,
int[][] solutions)
Display the cost matrix solved by the Hungarian algorithm in the LAP approach.
|
static void |
displayLAPresults(int[][] array) |
static String |
echoFeaturePenalties(Map<String,Double> featurePenalties) |
static void |
echoMatrix(double[][] m) |
static void |
echoSolutions(int[][] solutions) |
static Map<String,Object> |
getDefaultLAPSettingsMap()
Returns a new settings map filled with default values suitable for the
LAP trackers.
|
public static final String XML_ELEMENT_NAME_LINKING
public static final String XML_ELEMENT_NAME_GAP_CLOSING
public static final String XML_ELEMENT_NAME_MERGING
public static final String XML_ELEMENT_NAME_SPLITTING
public static final String XML_ELEMENT_NAME_FEATURE_PENALTIES
public static final boolean addFeaturePenaltyToSettings(Map<?,?> motherMap, Object motherKey, Object childKey, Object childValue, StringBuilder errorHolder)
motherMap - the mother mapmotherKey - the key in the mother map that points to the child mapchildKey - the key in the child map to putchildValue - the value in the child map to puterrorHolder - an error holder that will be appended with an error message if modifying the child
map is unsuccessful.public static final Map<String,Object> getDefaultLAPSettingsMap()
public static final double computeLinkingCostFor(Spot s0, Spot s1, double distanceCutOff, double blockingValue, Map<String,Double> featurePenalties)
This cost is calculated as follow:
D is calculated
p is calculated as
p = 3 × α × |f1-f2| / (f1+f2), where α is the factor
associated to the feature in the map. This expression is such that:
f1 and f2
are the same;
P = (1 + ∑ p )
C = ( D × P )²
public static final boolean checkSettingsValidity(Map<String,Object> settings, StringBuilder errorHolder)
settings - the map to test.errorHolder - a StringBuilder that will contain an error message if
the check is not successful.public static final boolean checkFeatureMap(Map<String,Object> map, String featurePenaltiesKey, StringBuilder errorHolder)
A feature penalty setting is valid if it is either null (not
here, that is) or an actual Map<String, Double>. Then,
all its keys must be Strings and all its values as well.
map - the map to inspect.featurePenaltiesKey - the key that should map to a feature penalty map.errorHolder - will be appended with an error message.public static final void echoMatrix(double[][] m)
public static final void displayCostMatrix(double[][] costs,
int nSegments,
int nSpots,
double blockingValue,
int[][] solutions)
costs - the cost matrixnSegments - the number of track segments found in the first step of the LAP trackingnSpots - the number of middle spots to considerblockingValue - the blocking value for costsolutions - the Hungarian assignment couplepublic static void echoSolutions(int[][] solutions)
public static void displayLAPresults(int[][] array)
Copyright © 2015–2021 Fiji. All rights reserved.