Class AnalysisUtils

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

public class AnalysisUtils extends Object
Static utilities for sc.fiji.analysis.
Author:
Tiago Ferreira
  • Method Details

    • getMetricLabel

      public static String getMetricLabel(String standardMetric, Tree tree)
      Assembles a label from a measurements metric and a spatial unit
      Parameters:
      standardMetric - SNT's supported metric, e.g., TreeStatistics.BRANCH_VOLUME
      tree - Tree from which spatial unit is extracted
      Returns:
      the metric label, e.g., "Branch volume (µm³)"
    • getMetricLabel

      public static String getMetricLabel(String standardMetric, String unit)
      Assembles a label from a measurements metric and a spatial unit
      Parameters:
      standardMetric - SNT's supported metric, e.g., TreeStatistics.BRANCH_VOLUME
      unit - the associated spatial uni (e.g., "µm")
      Returns:
      the metric label, e.g., "Branch volume (µm³)"
    • computeNBins

      public static int computeNBins(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics stats)
      Computes the "optimal" number of bins for a histogram dataset using Freedman-Diaconis rule.
      Parameters:
      stats - the descriptive statistics used to calculate the number of bins
      Returns:
      the computed number of bins for the histogram
    • ringPlot

      public static SNTChart ringPlot(String title, HashMap<String,Double> data, HashMap<String,Color> colors)
      Generates a ring plot (aka donut plot).
      Parameters:
      title - the title of the chart. Null allowed
      data - a map of data values where the key is a String label and the value is a Number representing the data associated with the label
      colors - a map of colors corresponding to the sections of the plot; if null, distinct colors will be automatically generated
      Returns:
      an instance of SNTChart containing the generated ring plot
    • boxPlot

      public static SNTChart boxPlot(String valueAxisLabel, org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset dataset)
    • polarPlot

      public static SNTChart polarPlot(String title, List<double[][]> seriesData, List<Color> seriesColors)
      Generates a polar plot
      Parameters:
      title - the title of the chart. Null allowed
      seriesData - the data (must be an array with length 2, containing two arrays of equal length, the first containing the x-values and the second containing the y-values)
      seriesColors - the series colors corresponding to the sections of the plot
      Returns:
      an instance of SNTChart containing the generated polar plot
    • createTimeline

      public static org.jfree.chart.JFreeChart createTimeline(Map<String,List<GrowthAnalyzer.GrowthPhase>> neuritePhases, String timeUnits)
      Creates a horizontal timeline chart with one row per neurite showing color-coded growth phases in sequence, so that each neurite gets one row with colored segments representing different phases.
      Parameters:
      neuritePhases - Map of neurite IDs to their growth phases
      timeUnits - Units for time axis
      Returns:
      JFreeChart with horizontal timeline visualization
    • ringPlot

      public static SNTChart ringPlot(String title, HashMap<GrowthAnalyzer.GrowthPhaseType,Double> phaseFrequencies)
      Creates a ring plot of growth phases.
      Parameters:
      title - The plot title
      phaseFrequencies - Map of growth phases to their frequencies
      Returns:
      JFreeChart with horizontal timeline visualization
    • replaceLegend

      public static void replaceLegend(org.jfree.chart.JFreeChart chart, org.jfree.chart.plot.XYPlot plot, org.jfree.chart.LegendItemCollection legendItems)
      Add a custom legend showing phase types and their colors.