public class Spot extends AbstractEuclideanSpace implements RealLocalizable, Comparable<Spot>
RealLocalizable
implementation, used in TrackMate to represent a
detection.
On top of being a RealLocalizable
, it can store additional numerical
named features, with a Map
-like syntax. Constructors enforce the
specification of the spot location in 3D space (if Z is unused, put 0), the
spot radius, and the spot quality. This somewhat cumbersome syntax is made to
avoid any bad surprise with missing features in a subsequent use. The spot
temporal features (FRAME
and POSITION_T
) are set upon
adding to a SpotCollection
.
Each spot received at creation a unique ID (as an int
), used
later for saving, retrieving and loading. Interfering with this value will
predictively cause undesired behavior.
Modifier and Type | Field and Description |
---|---|
static Map<String,Dimension> |
FEATURE_DIMENSIONS
The 7 privileged spot feature dimensions.
|
static Map<String,String> |
FEATURE_NAMES
The 7 privileged spot feature names.
|
static Map<String,String> |
FEATURE_SHORT_NAMES
The 7 privileged spot feature short names.
|
static Collection<String> |
FEATURES
The 7 privileged spot features that must be set by a spot detector:
QUALITY , POSITION_X , POSITION_Y ,
POSITION_Z , POSITION_Z , RADIUS , FRAME
. |
static String |
FRAME
The name of the frame feature.
|
static Comparator<Spot> |
frameComparator
A comparator used to sort spots by ascending frame.
|
static AtomicInteger |
IDcounter |
static Map<String,Boolean> |
IS_INT
The 7 privileged spot feature isInt flags.
|
static Comparator<Spot> |
nameComparator
A comparator used to sort spots by name.
|
static String[] |
POSITION_FEATURES
The position features.
|
static String |
POSITION_T
The name of the spot T position feature.
|
static String |
POSITION_X
The name of the spot X position feature.
|
static String |
POSITION_Y
The name of the spot Y position feature.
|
static String |
POSITION_Z
The name of the spot Z position feature.
|
static String |
QUALITY
The name of the spot quality feature.
|
static String |
RADIUS
The name of the radius spot feature.
|
static Comparator<Spot> |
timeComparator
A comparator used to sort spots by ascending time feature.
|
n
Constructor and Description |
---|
Spot(double x,
double y,
double z,
double radius,
double quality)
Creates a new spot, and gives it a default name.
|
Spot(double x,
double y,
double z,
double radius,
double quality,
String name)
Creates a new spot.
|
Spot(int ID)
Blank constructor meant to be used when loading a spot collection from a
file.
|
Spot(RealLocalizable location,
double radius,
double quality)
Creates a new spot, taking its 3D coordinates from a
RealLocalizable . |
Spot(RealLocalizable location,
double radius,
double quality,
String name)
Creates a new spot, taking its 3D coordinates from a
RealLocalizable . |
Spot(Spot spot)
Creates a new spot, taking its location, its radius, its quality value
and its name from the specified spot.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Spot o) |
double |
diffTo(Spot s,
String feature)
Returns the difference of the feature value for this spot with the one of
the specified spot.
|
String |
echo()
Return a string representation of this spot, with calculated features.
|
boolean |
equals(Object other) |
static Comparator<Spot> |
featureComparator(String feature)
A comparator used to sort spots by ascending feature values.
|
double |
getDoublePosition(int d) |
Double |
getFeature(String feature)
Returns the value corresponding to the specified spot feature.
|
Map<String,Double> |
getFeatures()
Exposes the storage map of features for this spot.
|
float |
getFloatPosition(int d) |
String |
getName() |
SpotRoi |
getRoi() |
int |
hashCode() |
int |
ID() |
void |
localize(double[] position) |
void |
localize(float[] position) |
double |
normalizeDiffTo(Spot s,
String feature)
Returns the absolute normalized difference of the feature value of this
spot with the one of the given spot.
|
void |
putFeature(String feature,
Double value)
Stores the specified feature value for this spot.
|
void |
setName(String name)
Set the name of this Spot.
|
void |
setRoi(SpotRoi roi) |
double |
squareDistanceTo(RealLocalizable s)
Returns the square distance from this spot to the specified spot.
|
String |
toString() |
numDimensions
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
localize, positionAsDoubleArray, positionAsRealPoint
numDimensions
public static AtomicInteger IDcounter
public static final String QUALITY
public static final String RADIUS
public static final String POSITION_X
public static final String POSITION_Y
public static final String POSITION_Z
public static final String POSITION_T
public static final String FRAME
public static final String[] POSITION_FEATURES
public static final Collection<String> FEATURES
QUALITY
, POSITION_X
, POSITION_Y
,
POSITION_Z
, POSITION_Z
, RADIUS
, FRAME
.public static final Map<String,String> FEATURE_NAMES
public static final Map<String,String> FEATURE_SHORT_NAMES
public static final Map<String,Dimension> FEATURE_DIMENSIONS
public static final Comparator<Spot> timeComparator
public static final Comparator<Spot> frameComparator
public static final Comparator<Spot> nameComparator
public Spot(double x, double y, double z, double radius, double quality, String name)
x
- the spot X coordinates, in image units.y
- the spot Y coordinates, in image units.z
- the spot Z coordinates, in image units.radius
- the spot radius, in image units.quality
- the spot quality.name
- the spot name.public Spot(double x, double y, double z, double radius, double quality)
x
- the spot X coordinates, in image units.y
- the spot Y coordinates, in image units.z
- the spot Z coordinates, in image units.radius
- the spot radius, in image units.quality
- the spot quality.public Spot(RealLocalizable location, double radius, double quality, String name)
RealLocalizable
. The RealLocalizable
must have at least 3
dimensions, and must return coordinates in image units.location
- the RealLocalizable
that contains the spot locatiob.radius
- the spot radius, in image units.quality
- the spot quality.name
- the spot name.public Spot(RealLocalizable location, double radius, double quality)
RealLocalizable
. The RealLocalizable
must have at least 3
dimensions, and must return coordinates in image units. The spot will get
a default name.location
- the RealLocalizable
that contains the spot locatiob.radius
- the spot radius, in image units.quality
- the spot quality.public Spot(Spot spot)
spot
- the spot to read from.public Spot(int ID)
IDcounter
field, so this
constructor should not be used for normal spot creation.ID
- the spot ID to setpublic int compareTo(Spot o)
compareTo
in interface Comparable<Spot>
public void setRoi(SpotRoi roi)
public SpotRoi getRoi()
public String getName()
public void setName(String name)
name
- the name to use.public int ID()
public String echo()
public Map<String,Double> getFeatures()
public Double getFeature(String feature)
feature
- The feature string to retrieve the stored value for.Double
. Will be null
if it has not been set.public void putFeature(String feature, Double value)
public double diffTo(Spot s, String feature)
A.diffTo(B) = - B.diffTo(A)
).
Will generate a NullPointerException
if one of the spots does not
store the named feature.
s
- the spot to compare to.feature
- the name of the feature to use for calculation.public double normalizeDiffTo(Spot s, String feature)
If a
and b
are the feature values, then the
absolute normalized difference is defined as
Math.abs( a - b) / ( (a+b)/2 )
.
By construction, this operation is symmetric (
A.normalizeDiffTo(B) =
B.normalizeDiffTo(A)
).
Will generate a NullPointerException
if one of the spots does not
store the named feature.
s
- the spot to compare to.feature
- the name of the feature to use for calculation.public double squareDistanceTo(RealLocalizable s)
s
- the spot to compute the square distance to.double
.public void localize(float[] position)
localize
in interface RealLocalizable
public void localize(double[] position)
localize
in interface RealLocalizable
public float getFloatPosition(int d)
getFloatPosition
in interface RealLocalizable
public double getDoublePosition(int d)
getDoublePosition
in interface RealLocalizable
public static final Comparator<Spot> featureComparator(String feature)
feature
- the feature to use for comparison. It is the caller
responsibility to ensure that all spots have the target
feature.Comparator
.Copyright © 2015–2021 Fiji. All rights reserved.