diff --git a/src/main/java/sc/fiji/snt/Path.java b/src/main/java/sc/fiji/snt/Path.java index b831f1a2..52382ca3 100644 --- a/src/main/java/sc/fiji/snt/Path.java +++ b/src/main/java/sc/fiji/snt/Path.java @@ -32,7 +32,6 @@ import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction; import org.apache.commons.math3.stat.StatUtils; -import org.apache.commons.math3.stat.descriptive.SummaryStatistics; import org.apache.commons.math3.stat.regression.SimpleRegression; import org.apache.commons.math3.util.MathUtils; import org.scijava.util.ColorRGB; @@ -399,6 +398,39 @@ public double getContraction() { return eDistance / length; } + /** + * Gets the fractal dimension of this path. + * + * @return the fractal dimension of this path or Double.NaN if this path has less than 5 nodes + */ + public double getFractalDimension() { + if (size() < 5) { // Must have at least 4 points after the start-node + return Double.NaN; + } + final List pathDists = new ArrayList<>(); + final List eucDists = new ArrayList<>(); + for (int i = 1; i < size(); i++) { //Start at the second node + double pDist = getNodeWithoutChecks(i).distanceTo(getNodeWithoutChecks(i - 1)); + if (!pathDists.isEmpty()) { + double cumDist = pathDists.get(i - 2) + pDist; + pathDists.add(cumDist); + } else { + pathDists.add(pDist); + } + double eDist = getNodeWithoutChecks(i).distanceTo(getNodeWithoutChecks(0)); + eucDists.add(eDist); + } + double numerator = 0.0; + for (int i = 0; i < eucDists.size(); i++) { + numerator += Math.log(1 + eucDists.get(i)) * Math.log(1 + pathDists.get(i)); + } + double denominator = 0.0; + for (final double eucDist : eucDists) { + denominator += Math.log(1 + eucDist) * Math.log(1 + eucDist); + } + return (double) numerator / denominator; + } + /** * Gets the length of this Path * @@ -419,8 +451,8 @@ public double getLength() { /* * Computes the angle between the specified node and its two flanking neighbors. *

- * If A being the specified node, B its previous neighbor, and C is subsequent neighbor, computes the angle - * between the vectors BA, and BC. + * With B being the specified node, A its previous neighbor, and C is subsequent neighbor, computes the angle + * between the vectors AB, and BC. *

* @return the angle in degrees (0-360 range) or Double.NaN if specified node does not have sufficient neighbors */ diff --git a/src/main/java/sc/fiji/snt/analysis/MultiTreeColorMapper.java b/src/main/java/sc/fiji/snt/analysis/MultiTreeColorMapper.java index e3beb952..7bd4365d 100644 --- a/src/main/java/sc/fiji/snt/analysis/MultiTreeColorMapper.java +++ b/src/main/java/sc/fiji/snt/analysis/MultiTreeColorMapper.java @@ -30,7 +30,6 @@ import net.imagej.display.ColorTables; import net.imglib2.display.ColorTable; -import org.checkerframework.checker.units.qual.A; import sc.fiji.snt.SNTUtils; import sc.fiji.snt.Tree; import sc.fiji.snt.annotation.AllenCompartment; diff --git a/src/main/java/sc/fiji/snt/analysis/TreeAnalyzer.java b/src/main/java/sc/fiji/snt/analysis/TreeAnalyzer.java index b076d325..816519ce 100644 --- a/src/main/java/sc/fiji/snt/analysis/TreeAnalyzer.java +++ b/src/main/java/sc/fiji/snt/analysis/TreeAnalyzer.java @@ -1301,41 +1301,14 @@ public double getAvgPartitionAsymmetry() throws IllegalArgumentException { * * @return a list containing the fractal dimension of each branch * @see StrahlerAnalyzer#getBranches() + * @see Path#getFractalDimension() * @throws IllegalArgumentException if the tree contains multiple roots or loops */ public List getFractalDimension() throws IllegalArgumentException { - final List branches = getBranches(); final List fractalDims = new ArrayList<>(); - for (final Path b : branches) { - // Must have at least 4 points after the start-node in a branch - if (b.size() < 5) { - continue; - } - final List pathDists = new ArrayList<>(); - final List eucDists = new ArrayList<>(); - // Start at the second node in the branch - for (int i = 1; i < b.size(); i++) { - double pDist = b.getNode(i).distanceTo(b.getNode(i-1)); - if (!pathDists.isEmpty()) { - double cumDist = pathDists.get(i-2) + pDist; - pathDists.add(cumDist); - } - else { - pathDists.add(pDist); - } - double eDist = b.getNode(i).distanceTo(b.getNode(0)); - eucDists.add(eDist); - } - double numerator = 0.0; - for (int i = 0; i < eucDists.size(); i++) { - numerator += Math.log(1 + eucDists.get(i)) * Math.log(1 + pathDists.get(i)); - } - double denominator = 0.0; - for (int i = 0; i < eucDists.size(); i++) { - denominator += Math.log(1 + eucDists.get(i)) * Math.log(1 + eucDists.get(i)); - } - double fDim = (double) numerator / denominator; - fractalDims.add(fDim); + for (final Path b : getBranches()) { + final double fDim = b.getFractalDimension(); + if (!Double.isNaN(fDim)) fractalDims.add(fDim); } return fractalDims; } diff --git a/src/main/java/sc/fiji/snt/analysis/TreeStatistics.java b/src/main/java/sc/fiji/snt/analysis/TreeStatistics.java index 8e1bbf34..aac6028a 100644 --- a/src/main/java/sc/fiji/snt/analysis/TreeStatistics.java +++ b/src/main/java/sc/fiji/snt/analysis/TreeStatistics.java @@ -60,56 +60,75 @@ */ public class TreeStatistics extends TreeAnalyzer { - /** Flag for {@value #LENGTH} analysis. */ - public static final String LENGTH = "Cable length"; - /** Flag for {@value #PATH_LENGTH} analysis. */ - public static final String PATH_LENGTH = "Path length"; - /** Flag for {@value #PATH_EXT_ANGLE_XY} analysis. */ - public static final String PATH_EXT_ANGLE_XY = "Path extension angle (XY plane)"; - /** Flag for {@value #PATH_EXT_ANGLE_XZ} analysis. */ - public static final String PATH_EXT_ANGLE_XZ = "Path extension angle (XZ plane)"; - /** Flag for {@value #PATH_EXT_ANGLE_ZY} analysis. */ - public static final String PATH_EXT_ANGLE_ZY = "Path extension angle (ZY plane)"; - /** Flag for {@value #BRANCH_LENGTH} analysis. */ - public static final String BRANCH_LENGTH = "Branch length"; - /** Flag for {@value #BRANCH_MEAN_RADIUS} analysis. */ - public static final String BRANCH_MEAN_RADIUS = "Branch mean radius"; + // branch angles /** Flag for {@value #INNER_EXTENSION_ANGLE_XY} analysis. */ - public static final String INNER_EXTENSION_ANGLE_XY = "Extension angle of inner branches (XY plane)"; + public static final String INNER_EXTENSION_ANGLE_XY = "Inner branches: Extension angle XY plane"; /** Flag for {@value #INNER_EXTENSION_ANGLE_XZ} analysis. */ - public static final String INNER_EXTENSION_ANGLE_XZ = "Extension angle of inner branches (XZ plane)"; + public static final String INNER_EXTENSION_ANGLE_XZ = "Inner branches: Extension angle XZ plane"; /** Flag for {@value #INNER_EXTENSION_ANGLE_ZY} analysis. */ - public static final String INNER_EXTENSION_ANGLE_ZY = "Extension angle of inner branches (ZY plane)"; + public static final String INNER_EXTENSION_ANGLE_ZY = "Inner branches: Extension angle ZY plane"; /** Flag for {@value #PRIMARY_EXTENSION_ANGLE_XY} analysis. */ - public static final String PRIMARY_EXTENSION_ANGLE_XY = "Extension angle of primary branches (XY plane)"; + public static final String PRIMARY_EXTENSION_ANGLE_XY = "Primary branches: Extension angle XY plane"; /** Flag for {@value #PRIMARY_EXTENSION_ANGLE_XZ} analysis. */ - public static final String PRIMARY_EXTENSION_ANGLE_XZ = "Extension angle of primary branches (XZ plane)"; + public static final String PRIMARY_EXTENSION_ANGLE_XZ = "Primary branches: Extension angle XZ plane"; /** Flag for {@value #PRIMARY_EXTENSION_ANGLE_ZY} analysis. */ - public static final String PRIMARY_EXTENSION_ANGLE_ZY = "Extension angle of primary branches (ZY plane)"; + public static final String PRIMARY_EXTENSION_ANGLE_ZY = "Primary branches: Extension angle ZY plane"; /** Flag for {@value #TERMINAL_EXTENSION_ANGLE_XY} analysis. */ - public static final String TERMINAL_EXTENSION_ANGLE_XY = "Extension angle of terminal branches (XY plane)"; + public static final String TERMINAL_EXTENSION_ANGLE_XY = "Terminal branches: Extension angle XY plane"; /** Flag for {@value #TERMINAL_EXTENSION_ANGLE_XZ} analysis. */ - public static final String TERMINAL_EXTENSION_ANGLE_XZ = "Extension angle of terminal branches (XZ plane)"; + public static final String TERMINAL_EXTENSION_ANGLE_XZ = "Terminal branches: Extension angle XZ plane"; /** Flag for {@value #TERMINAL_EXTENSION_ANGLE_ZY} analysis. */ - public static final String TERMINAL_EXTENSION_ANGLE_ZY = "Extension angle of terminal branches (ZY plane)"; - /** Flag for {@value #TERMINAL_LENGTH} analysis. */ - public static final String TERMINAL_LENGTH = "Length of terminal branches"; - /** Flag for {@value #PRIMARY_LENGTH} analysis. */ - public static final String PRIMARY_LENGTH = "Length of primary branches"; - /** Flag for {@value #INNER_LENGTH} analysis. */ - public static final String INNER_LENGTH = "Length of inner branches"; + public static final String TERMINAL_EXTENSION_ANGLE_ZY = "Terminal branches: Extension angle ZY plane"; + /** Flag for {@value #REMOTE_BIF_ANGLES} statistics. */ + public static final String REMOTE_BIF_ANGLES = "Remote bif. angles"; + // paths + /** Flag for {@value #PATH_LENGTH} analysis. */ + public static final String PATH_LENGTH = "Path length"; + /** Flag for {@value #PATH_EXT_ANGLE_XY} analysis. */ + public static final String PATH_EXT_ANGLE_XY = "Path extension angle XY plane"; + /** Flag for {@value #PATH_EXT_ANGLE_XZ} analysis. */ + public static final String PATH_EXT_ANGLE_XZ = "Path extension angle XZ plane"; + /** Flag for {@value #PATH_EXT_ANGLE_ZY} analysis. */ + public static final String PATH_EXT_ANGLE_ZY = "Path extension angle ZY plane"; /** Flag for {@value #PATH_ORDER} statistics. */ public static final String PATH_ORDER = "Path order"; /** Flag for {@value #PATH_CHANNEL} statistics. */ public static final String PATH_CHANNEL = "Path channel"; /** Flag for {@value #PATH_FRAME} statistics. */ public static final String PATH_FRAME = "Path frame"; + /** Flag for {@value #PATH_MEAN_RADIUS} statistics. */ + public static final String PATH_MEAN_RADIUS = "Path mean radius"; + /** Flag for {@value #PATH_SPINE_DENSITY} statistics */ + public static final String PATH_SPINE_DENSITY = "Path spine/varicosity density"; + /** Flag for {@value #PATH_CONTRACTION} statistics. */ + public static final String PATH_CONTRACTION = "Path contraction"; + /** Flag for {@value #PATH_FRACTAL_DIMENSION} statistics. */ + public static final String PATH_FRACTAL_DIMENSION = "Path fractal dimension"; + // branches + /** Flag for {@value #BRANCH_LENGTH} analysis. */ + public static final String BRANCH_LENGTH = "Branch length"; + /** Flag for {@value #BRANCH_MEAN_RADIUS} analysis. */ + public static final String BRANCH_MEAN_RADIUS = "Branch mean radius"; + /** Flag for {@value #TERMINAL_LENGTH} analysis. */ + public static final String TERMINAL_LENGTH = "Terminal branches: Length"; + /** Flag for {@value #PRIMARY_LENGTH} analysis. */ + public static final String PRIMARY_LENGTH = "Primary branches: Length"; + /** Flag for {@value #INNER_LENGTH} analysis. */ + public static final String INNER_LENGTH = "Inner branches: Length"; + /** Flag for {@value #BRANCH_CONTRACTION} statistics. */ + public static final String BRANCH_CONTRACTION = "Branch contraction"; + /** Flag for {@value #BRANCH_FRACTAL_DIMENSION} statistics. */ + public static final String BRANCH_FRACTAL_DIMENSION = "Branch fractal dimension"; + // nodes + /** Flag for {@value #NODE_RADIUS} statistics. */ + public static final String NODE_RADIUS = "Node radius"; /** Flag for {@value #INTER_NODE_ANGLE} statistics. */ public static final String INTER_NODE_ANGLE = "Internode angle"; /** Flag for {@value #INTER_NODE_DISTANCE} statistics. */ public static final String INTER_NODE_DISTANCE = "Internode distance"; /** Flag for {@value #INTER_NODE_DISTANCE_SQUARED} statistics. */ public static final String INTER_NODE_DISTANCE_SQUARED = "Internode distance (squared)"; + // counts /** Flag for {@value #N_BRANCH_POINTS} statistics. */ public static final String N_BRANCH_POINTS = "No. of branch points"; /** Flag for {@value #N_NODES} statistics. */ @@ -122,8 +141,6 @@ public class TreeStatistics extends TreeAnalyzer { public static final String N_PATHS = "No. of paths"; /** Flag for {@value #N_SPINES} statistics. */ public static final String N_SPINES = "No. of spines/varicosities"; - /** Flag for {@value #NODE_RADIUS} statistics. */ - public static final String NODE_RADIUS = "Node radius"; /** Flag specifying {@value #N_BRANCHES} statistics */ public static final String N_BRANCHES = "No. of branches"; /** Flag specifying {@value #N_PRIMARY_BRANCHES} statistics */ @@ -134,14 +151,17 @@ public class TreeStatistics extends TreeAnalyzer { public static final String N_TERMINAL_BRANCHES = "No. of terminal branches"; /** Flag specifying {@value #N_TIPS} statistics */ public static final String N_TIPS = "No. of tips"; - /** Flag for {@value #PATH_MEAN_RADIUS} statistics. */ - public static final String PATH_MEAN_RADIUS = "Path mean radius"; /** Flag for {@value #N_FITTED_PATHS} statistics */ public static final String N_FITTED_PATHS = "No. of fitted paths"; - /** Flag for {@value #PATH_SPINE_DENSITY} statistics */ - public static final String PATH_SPINE_DENSITY = "Path spine/varicosity density"; /** Flag for {@value #PATH_N_SPINES} statistics */ public static final String PATH_N_SPINES = "No. of spines/varicosities per path"; + //misc + /** Flag for {@value #LENGTH} analysis. */ + public static final String LENGTH = "Cable length"; + /** Flag for {@value #COMPLEXITY_INDEX_ACI} statistics. */ + public static final String COMPLEXITY_INDEX_ACI = "Complexity index: ACI"; + /** Flag for {@value #COMPLEXITY_INDEX_DCI} statistics. */ + public static final String COMPLEXITY_INDEX_DCI = "Complexity index: DCI"; /** Flag for {@value #X_COORDINATES} statistics. */ public static final String X_COORDINATES = "X coordinates"; /** Flag for {@value #Y_COORDINATES} statistics. */ @@ -154,24 +174,18 @@ public class TreeStatistics extends TreeAnalyzer { public static final String HEIGHT = "Height"; /** Flag for {@value #DEPTH} statistics */ public static final String DEPTH = "Depth"; - /** Flag for {@value #BRANCH_CONTRACTION} statistics. */ - public static final String BRANCH_CONTRACTION = "Branch contraction"; - /** Flag for {@value #PATH_CONTRACTION} statistics. */ - public static final String PATH_CONTRACTION = "Path contraction"; - /** Flag for {@value #REMOTE_BIF_ANGLES} statistics. */ - public static final String REMOTE_BIF_ANGLES = "Remote bif. angles"; /** Flag for {@value #PARTITION_ASYMMETRY} statistics. */ public static final String PARTITION_ASYMMETRY = "Partition asymmetry"; - /** Flag for {@value #BRANCH_FRACTAL_DIMENSION} statistics. */ - public static final String BRANCH_FRACTAL_DIMENSION = "Branch fractal dimension"; + // graph geodesics /** Flag for {@value #GRAPH_DIAMETER} statistics. */ - public static final String GRAPH_DIAMETER = "Length of longest shortest path"; + public static final String GRAPH_DIAMETER = "Longest shortest path: Length"; /** Flag for {@value #GRAPH_DIAMETER_ANGLE_XY} statistics. */ - public static final String GRAPH_DIAMETER_ANGLE_XY = "Angle of longest shortest path (XY plane)"; + public static final String GRAPH_DIAMETER_ANGLE_XY = "Longest shortest path: Extension angle XY plane"; /** Flag for {@value #GRAPH_DIAMETER_ANGLE_XZ} statistics. */ - public static final String GRAPH_DIAMETER_ANGLE_XZ = "Angle of longest shortest path (XZ plane)"; + public static final String GRAPH_DIAMETER_ANGLE_XZ = "Longest shortest path: Extension angle XZ plane"; /** Flag for {@value #GRAPH_DIAMETER_ANGLE_ZY} statistics. */ - public static final String GRAPH_DIAMETER_ANGLE_ZY = "Angle of longest shortest path (ZY plane)"; + public static final String GRAPH_DIAMETER_ANGLE_ZY = "Longest shortest path: Extension angle ZY plane"; + // volume and surface /** Flag for {@value #VOLUME} statistics. */ public static final String VOLUME = "Volume"; /** Flag for {@value #BRANCH_VOLUME} statistics. */ @@ -184,12 +198,12 @@ public class TreeStatistics extends TreeAnalyzer { public static final String BRANCH_SURFACE_AREA = "Branch surface area"; /** Flag for {@value #PATH_SURFACE_AREA} statistics. */ public static final String PATH_SURFACE_AREA = "Path surface area"; - /** Flag for {@value #COMPLEXITY_INDEX} statistics. */ - public static final String COMPLEXITY_INDEX = "Complexity index"; + // Strahler /** Flag specifying {@link StrahlerAnalyzer#getRootNumber() Horton-Strahler number} statistics */ public static final String STRAHLER_NUMBER = "Horton-Strahler root number"; /** Flag specifying {@link StrahlerAnalyzer#getAvgBifurcationRatio() Horton-Strahler bifurcation ratio} statistics */ public static final String STRAHLER_RATIO = "Horton-Strahler bifurcation ratio"; + // Sholl /** Flag specifying {@link sc.fiji.snt.analysis.sholl.math.LinearProfileStats#getMean() Sholl mean} statistics */ public static final String SHOLL_MEAN_VALUE = "Sholl: " + ShollAnalyzer.MEAN; /** Flag specifying {@link sc.fiji.snt.analysis.sholl.math.LinearProfileStats#getSum() Sholl sum} statistics */ @@ -214,6 +228,7 @@ public class TreeStatistics extends TreeAnalyzer { public static final String SHOLL_SKEWENESS = "Sholl: " + ShollAnalyzer.SKEWENESS; /** Flag specifying {@value #SHOLL_RAMIFICATION_INDEX} statistics */ public static final String SHOLL_RAMIFICATION_INDEX = "Sholl: " + ShollAnalyzer.RAMIFICATION_INDEX; + //convex hull /** Flag specifying {@value #CONVEX_HULL_BOUNDARY_SIZE} statistics */ public static final String CONVEX_HULL_BOUNDARY_SIZE = "Convex hull: " + ConvexHullAnalyzer.BOUNDARY_SIZE; /** Flag specifying {@value #CONVEX_HULL_SIZE} statistics */ @@ -226,6 +241,7 @@ public class TreeStatistics extends TreeAnalyzer { public static final String CONVEX_HULL_ROUNDNESS= "Convex hull: " + ConvexHullAnalyzer.ROUNDNESS; /** Flag specifying {@value #CONVEX_HULL_CENTROID_ROOT_DISTANCE} statistics */ public static final String CONVEX_HULL_CENTROID_ROOT_DISTANCE = "Convex hull: Centroid-root distance"; + /** * Flag for analysis of {@value #VALUES}, an optional numeric property that can * be assigned to Path nodes (e.g., voxel intensities), assigned via @@ -256,16 +272,16 @@ public class TreeStatistics extends TreeAnalyzer { private static final String[] ALL_FLAGS = { GRAPH_DIAMETER_ANGLE_XY, GRAPH_DIAMETER_ANGLE_XZ, GRAPH_DIAMETER_ANGLE_ZY, // BRANCH_CONTRACTION, BRANCH_FRACTAL_DIMENSION, BRANCH_LENGTH, - BRANCH_MEAN_RADIUS, BRANCH_SURFACE_AREA, BRANCH_VOLUME, COMPLEXITY_INDEX, CONVEX_HULL_BOUNDARY_SIZE, - CONVEX_HULL_BOXIVITY, CONVEX_HULL_CENTROID_ROOT_DISTANCE, CONVEX_HULL_ELONGATION, CONVEX_HULL_ROUNDNESS, - CONVEX_HULL_SIZE, DEPTH, // + BRANCH_MEAN_RADIUS, BRANCH_SURFACE_AREA, BRANCH_VOLUME, COMPLEXITY_INDEX_ACI, COMPLEXITY_INDEX_DCI, + CONVEX_HULL_BOUNDARY_SIZE, CONVEX_HULL_BOXIVITY, CONVEX_HULL_CENTROID_ROOT_DISTANCE, CONVEX_HULL_ELONGATION, + CONVEX_HULL_ROUNDNESS, CONVEX_HULL_SIZE, DEPTH, // INNER_EXTENSION_ANGLE_XY, INNER_EXTENSION_ANGLE_XZ, INNER_EXTENSION_ANGLE_ZY, PRIMARY_EXTENSION_ANGLE_XY, PRIMARY_EXTENSION_ANGLE_XZ, PRIMARY_EXTENSION_ANGLE_ZY, TERMINAL_EXTENSION_ANGLE_XY, TERMINAL_EXTENSION_ANGLE_XZ, TERMINAL_EXTENSION_ANGLE_ZY, // GRAPH_DIAMETER, HEIGHT, INNER_LENGTH, INTER_NODE_ANGLE, INTER_NODE_DISTANCE, INTER_NODE_DISTANCE_SQUARED, LENGTH, 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_FRAME, + NODE_RADIUS, PARTITION_ASYMMETRY, PATH_CHANNEL, PATH_CONTRACTION, PATH_FRACTAL_DIMENSION, PATH_FRAME, PATH_EXT_ANGLE_XY, PATH_EXT_ANGLE_XZ, PATH_EXT_ANGLE_ZY, PATH_LENGTH, PATH_MEAN_RADIUS, PATH_SPINE_DENSITY, PATH_N_SPINES, PATH_ORDER, PATH_SURFACE_AREA, PATH_VOLUME, PRIMARY_LENGTH, REMOTE_BIF_ANGLES, SHOLL_DECAY, SHOLL_KURTOSIS, SHOLL_MAX_FITTED, SHOLL_MAX_FITTED_RADIUS, SHOLL_MAX_VALUE, @@ -330,12 +346,13 @@ public static List getMetrics(final String type) { break; case "common": metrics = new String[] { BRANCH_CONTRACTION, BRANCH_FRACTAL_DIMENSION, BRANCH_LENGTH, BRANCH_MEAN_RADIUS, - BRANCH_SURFACE_AREA, BRANCH_VOLUME, COMPLEXITY_INDEX, CONVEX_HULL_SIZE, DEPTH, INNER_LENGTH, - INTER_NODE_ANGLE, INTER_NODE_DISTANCE, INTER_NODE_DISTANCE_SQUARED, LENGTH, N_BRANCH_POINTS, N_BRANCHES, - N_INNER_BRANCHES, N_NODES, N_PRIMARY_BRANCHES, N_SPINES, N_TERMINAL_BRANCHES, N_TIPS, NODE_RADIUS, - PARTITION_ASYMMETRY, PRIMARY_LENGTH, REMOTE_BIF_ANGLES, SHOLL_DECAY, SHOLL_MAX_VALUE, - SHOLL_MAX_FITTED, SHOLL_MAX_FITTED_RADIUS, SHOLL_MEAN_VALUE, SURFACE_AREA, STRAHLER_NUMBER, - TERMINAL_LENGTH, VALUES, VOLUME, X_COORDINATES, Y_COORDINATES, Z_COORDINATES }; + BRANCH_SURFACE_AREA, BRANCH_VOLUME, COMPLEXITY_INDEX_ACI, COMPLEXITY_INDEX_DCI, CONVEX_HULL_SIZE, + DEPTH, INNER_LENGTH, INTER_NODE_ANGLE, INTER_NODE_DISTANCE, INTER_NODE_DISTANCE_SQUARED, LENGTH, + N_BRANCH_POINTS, N_BRANCHES, N_INNER_BRANCHES, N_NODES, N_PRIMARY_BRANCHES, N_SPINES, + N_TERMINAL_BRANCHES, N_TIPS, NODE_RADIUS, PARTITION_ASYMMETRY, PRIMARY_LENGTH, REMOTE_BIF_ANGLES, + SHOLL_DECAY, SHOLL_MAX_VALUE, SHOLL_MAX_FITTED, SHOLL_MAX_FITTED_RADIUS, SHOLL_MEAN_VALUE, + SURFACE_AREA, STRAHLER_NUMBER, TERMINAL_LENGTH, VALUES, VOLUME, X_COORDINATES, Y_COORDINATES, + Z_COORDINATES }; break; case "quick": /* NB: This list can only include metrics supported by #getMetricWithoutChecks() */ @@ -942,7 +959,14 @@ protected void assembleStats(final StatisticsInstance stat, final String measure stat.addValue(Double.NaN); } break; - case COMPLEXITY_INDEX: + case COMPLEXITY_INDEX_ACI: + // implementation: doi: 10.1523/JNEUROSCI.4434-06.2007 + double sumPathOrders = 0; + for (final Path p : tree.list()) + sumPathOrders += p.getOrder() - 1; + stat.addValue(sumPathOrders / tree.list().size()); + break; + case COMPLEXITY_INDEX_DCI: try { // Implementation by chronological order: // www.jneurosci.org/content/19/22/9928#F6 @@ -984,13 +1008,15 @@ protected void assembleStats(final StatisticsInstance stat, final String measure case BRANCH_FRACTAL_DIMENSION: case FRACTAL_DIMENSION: try { - for (final double fDim : getFractalDimension()) - stat.addValue(fDim); + getFractalDimension().forEach(stat::addValue); } catch (final IllegalArgumentException ignored) { SNTUtils.log("Error: " + ignored.getMessage()); stat.addValue(Double.NaN); } break; + case PATH_FRACTAL_DIMENSION: + tree.list().forEach(p -> stat.addValue(p.getFractalDimension())); + break; case GRAPH_DIAMETER: try { stat.addValue(tree.getGraph().getLongestPath(true).getLength()); diff --git a/src/main/java/sc/fiji/snt/gui/MeasureUI.java b/src/main/java/sc/fiji/snt/gui/MeasureUI.java index ca7d72e6..89c075a8 100644 --- a/src/main/java/sc/fiji/snt/gui/MeasureUI.java +++ b/src/main/java/sc/fiji/snt/gui/MeasureUI.java @@ -210,7 +210,7 @@ public boolean isCellEditable(final int row, final int column) { // Enlarge default width of first column. Another option would be to have all // columns to auto-fit at all times, e.g., https://stackoverflow.com/a/25570812. // Maybe that would be better? - final String prototypeMetric = TreeStatistics.TERMINAL_EXTENSION_ANGLE_XY; + final String prototypeMetric = TreeStatistics.GRAPH_DIAMETER_ANGLE_XY; for (int i = 0; i < statsTable.getColumnCount(); ++i) { final int width = SwingUtilities.computeStringWidth(statsTable.getFontMetrics(statsTable.getFont()), (i == 0) ? prototypeMetric : MEAN); diff --git a/src/main/java/sc/fiji/snt/gui/SWCExportDialog.java b/src/main/java/sc/fiji/snt/gui/SWCExportDialog.java index 8a8e4c52..5f49868d 100644 --- a/src/main/java/sc/fiji/snt/gui/SWCExportDialog.java +++ b/src/main/java/sc/fiji/snt/gui/SWCExportDialog.java @@ -179,7 +179,6 @@ public void setCollapsed(final boolean collapse) { private CollapsiblePanel warningPanel() { final JLabel label = GuiUtils.leftAlignedLabel("The following data is not stored in SWC files:" // + "
    " // - + "
  • Image properties
  • "// + "
  • Fits: Path refinements that do not override original nodes
  • "// + "
  • Fills: All types
  • "// + "
  • Channel and frame position of path(s)
  • "// diff --git a/src/main/java/sc/fiji/snt/plugin/GroupAnalyzerCmd.java b/src/main/java/sc/fiji/snt/plugin/GroupAnalyzerCmd.java index 3e765569..6415ce48 100644 --- a/src/main/java/sc/fiji/snt/plugin/GroupAnalyzerCmd.java +++ b/src/main/java/sc/fiji/snt/plugin/GroupAnalyzerCmd.java @@ -24,7 +24,6 @@ import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; diff --git a/src/main/java/sc/fiji/snt/plugin/PathAnalyzerCmd.java b/src/main/java/sc/fiji/snt/plugin/PathAnalyzerCmd.java index 975a32e3..d5ec0436 100644 --- a/src/main/java/sc/fiji/snt/plugin/PathAnalyzerCmd.java +++ b/src/main/java/sc/fiji/snt/plugin/PathAnalyzerCmd.java @@ -196,7 +196,7 @@ public void run() { metrics.add(PathAnalyzer.CONVEX_HULL_ELONGATION); metrics.add(PathAnalyzer.CONVEX_HULL_ROUNDNESS); } - if (fractalDimension) metrics.add(PathAnalyzer.BRANCH_FRACTAL_DIMENSION); // will be computed for paths + if (fractalDimension) metrics.add(PathAnalyzer.PATH_FRACTAL_DIMENSION); if (nBranchPoints) metrics.add(PathAnalyzer.N_BRANCH_POINTS); if (pathContraction) metrics.add(PathAnalyzer.PATH_CONTRACTION); if (pathFragmentation) metrics.add(PathAnalyzer.N_PATH_NODES); diff --git a/src/main/java/sc/fiji/snt/plugin/TreeMapperCmd.java b/src/main/java/sc/fiji/snt/plugin/TreeMapperCmd.java index fd8030ac..5c0c78c8 100644 --- a/src/main/java/sc/fiji/snt/plugin/TreeMapperCmd.java +++ b/src/main/java/sc/fiji/snt/plugin/TreeMapperCmd.java @@ -200,15 +200,6 @@ private void removeColorCoding() { statusService.showStatus("Color code removed..."); } - private boolean isLargeData() { - long sum = 0; - for (final Tree tree : trees) { - sum += tree.getNodesCount(); - if (sum > 10000) return true; - } - return false; - } - /* IDE debug method **/ public static void main(final String[] args) throws IOException { final ImageJ ij = new ImageJ();