Class CandidatePathMetrics

java.lang.Object
sc.fiji.snt.analysis.CandidatePathMetrics

public final class CandidatePathMetrics extends Object
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 Classes
    Modifier and Type
    Class
    Description
    static enum 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Default radius (in units of the smallest voxel side) of the cross-sectional disk sampled around each node
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[][]
    compute(Path[] paths, net.imglib2.RandomAccessibleInterval<?> img)
    Computes all metrics for a set of candidate paths linking the same endpoints.
    static double[][]
    compute(Path[] paths, net.imglib2.RandomAccessibleInterval<?> img, int radius)
    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 boolean
    isBest(double[][] values, CandidatePathMetrics.Metric metric, int row)
    Checks if a value is the best in its column.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_RADIUS

      public static final int DEFAULT_RADIUS
      Default radius (in units of the smallest voxel side) of the cross-sectional disk sampled around each node
      See Also:
  • Method Details

    • compute

      public static double[][] compute(Path[] paths, net.imglib2.RandomAccessibleInterval<?> img)
      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 coordinates
      radius - 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 coordinates
      radius - 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
      cancelled - 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 - if cancelled returned true
    • isBest

      public static boolean isBest(double[][] values, CandidatePathMetrics.Metric metric, int row)
      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 of compute(Path[], RandomAccessibleInterval)
      metric - the metric (column)
      row - the row (path) index
      Returns:
      true if the value at row is the best (or tied for best) in its column