Package sc.fiji.snt.analysis
Class AnalysisUtils
java.lang.Object
sc.fiji.snt.analysis.AnalysisUtils
Static utilities for sc.fiji.analysis.
- Author:
- Tiago Ferreira
-
Method Summary
Modifier and TypeMethodDescriptionstatic SNTChartboxPlot(String valueAxisLabel, org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset dataset) static intcomputeNBins(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics stats) Computes the "optimal" number of bins for a histogram dataset using Freedman-Diaconis rule.static org.jfree.chart.JFreeChartcreateTimeline(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.static StringgetMetricLabel(String standardMetric, String unit) Assembles a label from a measurements metric and a spatial unitstatic StringgetMetricLabel(String standardMetric, Tree tree) Assembles a label from a measurements metric and a spatial unitstatic SNTChartGenerates a polar plotstatic voidreplaceLegend(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.static SNTChartGenerates a ring plot (aka donut plot).static SNTChartringPlot(String title, HashMap<GrowthAnalyzer.GrowthPhaseType, Double> phaseFrequencies) Creates a ring plot of growth phases.
-
Method Details
-
getMetricLabel
Assembles a label from a measurements metric and a spatial unit- Parameters:
standardMetric- SNT's supported metric, e.g.,TreeStatistics.BRANCH_VOLUMEtree-Treefrom which spatial unit is extracted- Returns:
- the metric label, e.g., "Branch volume (µm³)"
-
getMetricLabel
Assembles a label from a measurements metric and a spatial unit- Parameters:
standardMetric- SNT's supported metric, e.g.,TreeStatistics.BRANCH_VOLUMEunit- 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 alloweddata- a map of data values where the key is a String label and the value is a Number representing the data associated with the labelcolors- 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
-
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 allowedseriesData- 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 phasestimeUnits- 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 titlephaseFrequencies- 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.
-