Class PathStatistics
- All Implemented Interfaces:
Runnable,org.scijava.Cancelable,org.scijava.command.Command,org.scijava.Contextual,org.scijava.plugin.SciJavaPlugin
TreeStatistics for analyzing individual paths
without considering their connectivity relationships.
PathStatistics provides morphometric analysis of neuronal paths while treating each path as an independent entity, rather than as part of a connected tree structure.
Key differences from TreeStatistics:- No graph conversion - paths are analyzed independently
- Branch-related metrics are redefined to work with individual paths
- Supports path-specific measurements like Path ID and number of children
- Provides individual path measurement capabilities
// Analyze a single path
PathStatistics stats = new PathStatistics(path);
double length = stats.getMetric("Path length").doubleValue();
// Analyze multiple paths independently
Collection<Path> paths = getPaths();
PathStatistics multiStats = new PathStatistics(paths, "My Analysis");
multiStats.measureIndividualPaths(Arrays.asList("Path length", "N. nodes"), true);
- Author:
- Tiago Ferreira
- See Also:
-
Field Summary
FieldsFields inherited from class sc.fiji.snt.analysis.TreeStatistics
AVG_SPINE_DENSITY, BRANCH_CONTRACTION, BRANCH_EXTENSION_ANGLE, BRANCH_EXTENSION_ANGLE_REL, BRANCH_EXTENSION_ANGLE_XY, BRANCH_EXTENSION_ANGLE_XZ, BRANCH_EXTENSION_ANGLE_ZY, BRANCH_FRACTAL_DIMENSION, BRANCH_LENGTH, BRANCH_MEAN_RADIUS, BRANCH_SURFACE_AREA, BRANCH_VOLUME, COMPLEXITY_INDEX_ACI, COMPLEXITY_INDEX_DCI, CONTRACTION, CONVEX_HULL_BOUNDARY_SIZE, CONVEX_HULL_BOXIVITY, CONVEX_HULL_CENTROID_ROOT_DISTANCE, CONVEX_HULL_COMPACTNESS_3D, CONVEX_HULL_ECCENTRICITY_2D, CONVEX_HULL_ELONGATION, CONVEX_HULL_ROUNDNESS, CONVEX_HULL_SIZE, DEPTH, FRACTAL_DIMENSION, GRAPH_DIAMETER, GRAPH_DIAMETER_ANGLE, GRAPH_DIAMETER_ANGLE_XY, GRAPH_DIAMETER_ANGLE_XZ, GRAPH_DIAMETER_ANGLE_ZY, HEIGHT, INNER_EXTENSION_ANGLE, INNER_EXTENSION_ANGLE_REL, INNER_EXTENSION_ANGLE_XY, INNER_EXTENSION_ANGLE_XZ, INNER_EXTENSION_ANGLE_ZY, INNER_LENGTH, innerBranches, INTER_NODE_ANGLE, INTER_NODE_DISTANCE, INTER_NODE_DISTANCE_SQUARED, lastDstats, LENGTH, MEAN_RADIUS, N_BRANCH_NODES, N_BRANCH_POINTS, N_BRANCHES, N_FITTED_PATHS, N_INNER_BRANCHES, N_NODES, N_PATH_NODES, N_PATHS, N_PRIMARY_BRANCHES, N_SPINES, N_TERMINAL_BRANCHES, N_TIPS, NODE_RADIUS, PARTITION_ASYMMETRY, PATH_CHANNEL, PATH_CONTRACTION, PATH_EXT_ANGLE, PATH_EXT_ANGLE_REL, PATH_EXT_ANGLE_XY, PATH_EXT_ANGLE_XZ, PATH_EXT_ANGLE_ZY, PATH_FRACTAL_DIMENSION, PATH_FRAME, PATH_LENGTH, PATH_MEAN_RADIUS, PATH_N_SPINES, PATH_ORDER, PATH_SPINE_DENSITY, PATH_SURFACE_AREA, PATH_VOLUME, PRIMARY_EXTENSION_ANGLE, PRIMARY_EXTENSION_ANGLE_XY, PRIMARY_EXTENSION_ANGLE_XZ, PRIMARY_EXTENSION_ANGLE_ZY, PRIMARY_LENGTH, primaryBranches, REMOTE_BIF_ANGLES, ROOT_ANGLE_B_FACTOR, ROOT_ANGLE_C_BIAS, ROOT_ANGLE_M_DIRECTION, SHOLL_DECAY, SHOLL_KURTOSIS, SHOLL_MAX_FITTED, SHOLL_MAX_FITTED_RADIUS, SHOLL_MAX_VALUE, SHOLL_MEAN_VALUE, SHOLL_N_MAX, SHOLL_N_SECONDARY_MAX, SHOLL_POLY_FIT_DEGREE, SHOLL_RAMIFICATION_INDEX, SHOLL_SKEWNESS, SHOLL_SUM_VALUE, statusService, STRAHLER_NUMBER, STRAHLER_RATIO, SURFACE_AREA, table, TERMINAL_EXTENSION_ANGLE, TERMINAL_EXTENSION_ANGLE_REL, TERMINAL_EXTENSION_ANGLE_XY, TERMINAL_EXTENSION_ANGLE_XZ, TERMINAL_EXTENSION_ANGLE_ZY, TERMINAL_LENGTH, terminalBranches, tips, tree, VALUES, VOLUME, WIDTH, X_COORDINATES, Y_COORDINATES, Z_COORDINATES -
Constructor Summary
ConstructorsConstructorDescriptionPathStatistics(Collection<Path> paths, String label) Instantiates PathStatistics from a collection of paths.PathStatistics(Path path) Instantiates PathStatistics from a single path. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassembleStats(sc.fiji.snt.analysis.TreeStatistics.StatisticsInstance stat, String measurement) Gets all the paths being analyzed as branches.protected intGets the inner branches from the analyzed paths.doubleGets the total length of inner branches.Gets a summary metric for the analyzed paths.Gets a specific metric value for an individual path.intGets the number of branches (paths) being analyzed.Gets the primary branches from the analyzed paths.doubleGets the total length of primary branches.org.apache.commons.math3.stat.descriptive.SummaryStatisticsgetSummaryStats(String metric) Computes theSummaryStatisticsfor the specified measurement.Gets the terminal branches from the analyzed paths.doubleGets the total length of terminal branches.voidmeasureIndividualPaths(Collection<String> metrics, boolean summarize) Measures specified metrics for each individual path and creates a detailed table.Methods inherited from class sc.fiji.snt.analysis.TreeStatistics
contains, dispose, fromCollection, getAllMetrics, getAnnotatedLength, getAnnotatedLength, getAnnotatedLength, getAnnotatedLength, getAnnotatedLengthHistogram, getAnnotatedLengthHistogram, getAnnotatedLengthHistogram, getAnnotatedLengthHistogram, getAnnotatedLengthsByHemisphere, getAnnotatedLengthsByHemisphere, getAnnotatedLengthsByHemisphereHistogram, getAnnotations, getAnnotations, getAvgBranchLength, getAvgContraction, getAvgFractalDimension, getAvgFragmentation, getAvgPartitionAsymmetry, getAvgRemoteBifAngle, getBranchPoints, getBranchPoints, getBranchPoints, getCableLength, getCableLength, getCableLength, getCableLengthNorm, getCableLengthNorm, getConvexAnalyzer, getConvexHullMetric, getDepth, getDescriptiveStats, getFlowPlot, getFlowPlot, getFlowPlot, getFlowPlot, getFlowPlot, getFractalDimension, getHeight, getHighestPathOrder, getHistogram, getHistogram, getMetrics, getMetrics, getNBranchPoints, getNBranchPoints, getNBranchPointsNorm, getNBranchPointsNorm, getNextRow, getNFittedPaths, getNNodes, getNodeStatistics, getNodeStatistics, getNormalizedMeasurement, getNoSpinesOrVaricosities, getNPaths, getNTips, getNTips, getNTipsNorm, getNTipsNorm, getParsedTree, getPartitionAsymmetry, getPolarHistogram, getPrimaryPaths, getRemoteBifAngles, getRootAngleAnalyzer, getRootAngleMetric, getShollAnalyzer, getShollMetric, getSpatialUnit, getSpineOrVaricosityDensity, getStrahlerAnalyzer, getStrahlerBifurcationRatio, getStrahlerNumber, getSWCTypesAsString, getTable, getTips, getTips, getTips, getTips, getTips, getUnit, getWidth, isExactMetricMatch, isValid, lastDstatsCanBeRecycled, main, measure, measure, resetRestrictions, restrictToSWCType, run, setExactMetricMatch, setTable, setTable, summarize, summarize, tryReallyHardToGuessMetric, updateAndDisplayTableMethods inherited from class org.scijava.command.ContextCommand
cancel, getCancelReason, isCanceledMethods inherited from class org.scijava.AbstractContextual
context, getContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.scijava.Contextual
setContext
-
Field Details
-
N_CHILDREN
Flag for "No. of children" analysis.- See Also:
-
-
Constructor Details
-
PathStatistics
Instantiates PathStatistics from a collection of paths.Creates a PathStatistics instance for analyzing a collection of Path objects. The spatial unit is automatically determined from the paths if they all share the same calibration unit.
- Parameters:
paths- the collection of paths to be analyzedlabel- the label describing the path collection
-
PathStatistics
Instantiates PathStatistics from a single path.Creates a PathStatistics instance for analyzing a single Path object. The path's name is used as the label for the analysis.
- Parameters:
path- the path to be analyzed
-
-
Method Details
-
getBranches
Gets all the paths being analyzed as branches.In PathStatistics, all paths are considered as branches since each path represents a distinct structural element.
- Overrides:
getBranchesin classTreeStatistics- Returns:
- the list of all paths
- See Also:
-
getNBranches
public int getNBranches()Gets the number of branches (paths) being analyzed.Returns the total count of paths in this PathStatistics instance.
- Overrides:
getNBranchesin classTreeStatistics- Returns:
- the number of paths
-
getMetric
Gets a summary metric for the analyzed paths.Extends the parent class functionality to support path-specific metrics such as "Path ID". For single-path analyses, returns the specific path ID; for multi-path analyses, returns NaN for path-specific metrics.
- Overrides:
getMetricin classTreeStatistics- Parameters:
metric- the name of the metric to retrieve- Returns:
- the metric value, or NaN if not applicable
- Throws:
UnknownMetricException- if the metric is not recognized- See Also:
-
getPrimaryBranches
Gets the primary branches from the analyzed paths.Returns only those paths that are marked as primary branches, typically those that originate directly from the root or soma.
- Overrides:
getPrimaryBranchesin classTreeStatistics- Returns:
- the list of primary paths
- See Also:
-
getTerminalBranches
Gets the terminal branches from the analyzed paths.Returns paths that have children, representing non-terminal segments. Note: This implementation differs from typical terminal branch definition as it returns paths with children rather than leaf paths.
- Overrides:
getTerminalBranchesin classTreeStatistics- Returns:
- the list of paths with children
- See Also:
-
getPrimaryLength
public double getPrimaryLength()Gets the total length of primary branches.Calculates the sum of lengths of all paths marked as primary branches.
- Overrides:
getPrimaryLengthin classTreeStatistics- Returns:
- the total length of primary branches
- See Also:
-
getTerminalLength
public double getTerminalLength()Gets the total length of terminal branches.Calculates the sum of lengths of all terminal branches as defined by
getTerminalBranches().- Overrides:
getTerminalLengthin classTreeStatistics- Returns:
- the total length of terminal branches
- See Also:
-
getInnerBranches
Gets the inner branches from the analyzed paths.In PathStatistics, inner branches are equivalent to primary branches.
- Overrides:
getInnerBranchesin classTreeStatistics- Returns:
- the list of inner branches (same as primary branches)
- See Also:
-
getInnerLength
public double getInnerLength()Gets the total length of inner branches.In PathStatistics, this returns the same value as
getPrimaryLength().- Overrides:
getInnerLengthin classTreeStatistics- Returns:
- the total length of inner branches
- See Also:
-
getCol
- Overrides:
getColin classTreeStatistics
-
assembleStats
protected void assembleStats(sc.fiji.snt.analysis.TreeStatistics.StatisticsInstance stat, String measurement) - Overrides:
assembleStatsin classTreeStatistics
-
getSummaryStats
Description copied from class:TreeStatisticsComputes theSummaryStatisticsfor the specified measurement.- Overrides:
getSummaryStatsin classTreeStatistics- Parameters:
metric- the measurement (TreeStatistics.N_NODES,TreeStatistics.NODE_RADIUS, etc.)- Returns:
- the SummaryStatistics object.
-
getMetric
Gets a specific metric value for an individual path.This method provides direct access to morphometric properties of individual paths, including geometric measurements, connectivity information, and structural characteristics. It supports all standard path metrics plus PathStatistics-specific measurements.
Supported metrics include:- Geometric: length, volume, surface area, mean radius
- Structural: number of nodes, branch points, children
- Angular: extension angles in XY, XZ, ZY planes
- Morphological: contraction, fractal dimension, spine density
- Metadata: path ID, channel, frame, order
- Parameters:
metric- the name of the metric to retrievepath- the specific path to measure- Returns:
- the metric value for the specified path
- Throws:
UnknownMetricException- if the metric is not recognized
-
measureIndividualPaths
Measures specified metrics for each individual path and creates a detailed table.This method generates a comprehensive measurement table where each row represents an individual path and columns contain the requested morphometric measurements. This is particularly useful for comparative analysis of path properties or for exporting detailed morphometric data.
The generated table includes:- Path identification information (name, SWC type)
- All requested morphometric measurements
- Optional summary statistics (if summarize is true)
- Parameters:
metrics- the collection of metric names to measure for each path. If null or empty, a default "safe" set of metrics is usedsummarize- if true, adds summary statistics to the table
-