Package sc.fiji.snt.analysis
Class CandidatePathMetrics
java.lang.Object
sc.fiji.snt.analysis.CandidatePathMetrics
Quality metrics for a set of candidate paths linking the same two endpoints (e.g., paths computed with different
cost functions). Metrics are descriptive: they do not assume a ground truth and are meant to be compared across
candidates (column-wise), not combined into a single score. Background statistics are pooled across all candidates
so that every path is judged against the same local background.
Paths are expected to be in the voxel space of img (i.e., Path.getXUnscaledDouble(int) and friends
index into img).
- Author:
- Tiago Ferreira
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe metrics computed bycompute(Path[], RandomAccessibleInterval) -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault radius (in units of the smallest voxel side) of the cross-sectional disk sampled around each node -
Method Summary
Modifier and TypeMethodDescriptionstatic double[][]Computes all metrics for a set of candidate paths linking the same endpoints.static double[][]Computes all metrics for a set of candidate paths linking the same endpoints.static double[][]compute(Path[] paths, net.imglib2.RandomAccessibleInterval<?> img, int radius, BooleanSupplier cancelled) Computes all metrics for a set of candidate paths linking the same endpoints.static booleanisBest(double[][] values, CandidatePathMetrics.Metric metric, int row) Checks if a value is the best in its column.
-
Field Details
-
DEFAULT_RADIUS
public static final int DEFAULT_RADIUSDefault radius (in units of the smallest voxel side) of the cross-sectional disk sampled around each node- See Also:
-
-
Method Details
-
compute
Computes all metrics for a set of candidate paths linking the same endpoints.- Parameters:
paths- the candidate paths (null entries are allowed and yield NaN rows)img- the image the paths were computed on. Must be accessible at the paths' unscaled node coordinates- Returns:
- the metric values, indexed as
[pathIndex][Metric.ordinal()]. NaN means 'not computable'
-
compute
public static double[][] compute(Path[] paths, net.imglib2.RandomAccessibleInterval<?> img, int radius) Computes all metrics for a set of candidate paths linking the same endpoints.- Parameters:
paths- the candidate paths (null entries are allowed and yield NaN rows)img- the image the paths were computed on. Must be accessible at the paths' unscaled node coordinatesradius- the radius (in units of the smallest voxel side) of the cross-sectional disk sampled around each node. Should be larger than the expected radius of the neurite. Clamped to a sensible range- Returns:
- the metric values, indexed as
[pathIndex][Metric.ordinal()]. NaN means 'not computable'
-
compute
public static double[][] compute(Path[] paths, net.imglib2.RandomAccessibleInterval<?> img, int radius, BooleanSupplier cancelled) throws CancellationException Computes all metrics for a set of candidate paths linking the same endpoints. Very long paths are subsampled (every k-th node) for the most expensive metrics.- Parameters:
paths- the candidate paths (null entries are allowed and yield NaN rows)img- the image the paths were computed on. Must be accessible at the paths' unscaled node coordinatesradius- the radius (in units of the smallest voxel side) of the cross-sectional disk sampled around each node. Should be larger than the expected radius of the neurite. Clamped to a sensible rangecancelled- polled regularly: if it returns true the computation is aborted- Returns:
- the metric values, indexed as
[pathIndex][Metric.ordinal()]. NaN means 'not computable' - Throws:
CancellationException- ifcancelledreturned true
-
isBest
Checks if a value is the best in its column. Values that are displayed identically to the best one (CandidatePathMetrics.Metric.format(double)) are also reported as best. At least two non-NaN values are needed in the column for any of them to be called best.- Parameters:
values- the output ofcompute(Path[], RandomAccessibleInterval)metric- the metric (column)row- the row (path) index- Returns:
- true if the value at
rowis the best (or tied for best) in its column
-