Class ConvexHullAnalyzer

java.lang.Object
org.scijava.AbstractContextual
org.scijava.command.ContextCommand
sc.fiji.snt.analysis.ConvexHullAnalyzer
All Implemented Interfaces:
Runnable, org.scijava.Cancelable, org.scijava.command.Command, org.scijava.Contextual, org.scijava.plugin.SciJavaPlugin

public class ConvexHullAnalyzer extends org.scijava.command.ContextCommand
Class for Convex Hull measurements of a Tree.
Author:
Cameron Arshadi, Tiago Ferreira
See Also:
  • Field Details

  • Constructor Details

    • ConvexHullAnalyzer

      public ConvexHullAnalyzer(Tree tree)
      Instantiates a new convex hull analyzer.
      Parameters:
      tree - the Tree to be analyzed
    • ConvexHullAnalyzer

      public ConvexHullAnalyzer(AbstractConvexHull convexHull)
      Instantiates a new convex hull analyzer.
      Parameters:
      convexHull - the Convex hull to be analyzed
  • Method Details

    • context

      public org.scijava.Context context()
      Specified by:
      context in interface org.scijava.Contextual
      Overrides:
      context in class org.scijava.AbstractContextual
    • getContext

      public org.scijava.Context getContext()
      Specified by:
      getContext in interface org.scijava.Contextual
      Overrides:
      getContext in class org.scijava.AbstractContextual
    • run

      public void run()
    • supportedMetrics

      public static List<String> supportedMetrics()
      Gets the list of metrics supported by ConvexHullAnalyzer.
      Returns:
      the list of supported metric names that can be computed by this analyzer
    • getAnalysis

      public Map<String,Double> getAnalysis()
      Gets all computed convex hull analysis metrics.

      Returns a map containing all the computed convex hull metrics and their values. The metrics are computed lazily and cached for subsequent calls. If the hull cannot be computed, all metrics return NaN.

      Returns:
      a map of metric names to their computed values
    • dump

      public void dump(SNTTable table)
    • getHull

      public AbstractConvexHull getHull()
      Gets the convex hull object being analyzed. The hull is initialized if needed.
      Returns:
      the convex hull object
    • get

      public double get(String metric)
      Gets the value of a specific convex hull metric.

      Retrieves the computed value for the specified metric name. The metric must be one of the supported metrics returned by supportedMetrics().

      Parameters:
      metric - the name of the metric to retrieve
      Returns:
      the computed value for the metric
      See Also:
    • getCentroid

      public PointInImage getCentroid()
    • getBoxivity

      public double getBoxivity()
      Gets the boxivity of the convex hull, which measures how box-like the convex hull is. Values closer to 1 indicate a more box-like shape.
      Returns:
      the boxivity value
    • getElongation

      public double getElongation()
      Gets the elongation of the convex hull, which measures how elongated the convex hull is. Higher values indicate more elongated shapes.
      Returns:
      the elongation value
    • getRoundness

      public double getRoundness()
      Gets the roundness of the convex hull, which measures how round or circular the convex hull is. Values closer to 1 indicate a more round shape.
      Returns:
      the roundness value
    • getSize

      public double getSize()
      Gets the size (area or volume) of the convex hull, which is the area for 2D hulls or the volume for 3D hulls.
      Returns:
      the size of the convex hull
    • getBoundarySize

      public double getBoundarySize()
      Gets the boundary size (perimeter for 2D hulls or surface area for 3D hulls) of the convex hull.
      Returns:
      the boundary size of the convex hull
    • getCompactness

      public double getCompactness()
    • getEccentricity

      public double getEccentricity()
    • computeRoundness

      protected double computeRoundness(AbstractConvexHull hull)
    • computeBoxivity

      protected double computeBoxivity(AbstractConvexHull hull)
    • computeCentroid

      protected net.imglib2.RealLocalizable computeCentroid(AbstractConvexHull hull)
    • computeElongation

      protected double computeElongation(AbstractConvexHull hull)
    • computeHull

      protected AbstractConvexHull computeHull(Tree tree)
    • setLabel

      public void setLabel(String analysisLabel)
      Sets the optional description for the analysis
      Parameters:
      analysisLabel - a string describing the analysis
    • getTree

      public Tree getTree()
      Gets the tree being analyzed.
      Returns:
      the tree being analyzed, or null if the analyzer was created directly from a convex hull.
    • getUnit

      public String getUnit(String metric)
      Returns the physical unit associated with the specified metric.
      Parameters:
      metric - the supported metric to be queried (case-sensitive)
      Returns:
      physical unit
      See Also:
    • main

      public static void main(String[] args) throws InterruptedException
      Main method for testing and demonstration purposes.

      Creates a ConvexHullAnalyzer instance using demo data and runs the analysis. This method is primarily used for development and debugging.

      Parameters:
      args - command line arguments (not used)
      Throws:
      InterruptedException - if the execution is interrupted