Class PCAnalyzer.PrincipalAxis

java.lang.Object
sc.fiji.snt.analysis.PCAnalyzer.PrincipalAxis
Enclosing class:
PCAnalyzer

public static class PCAnalyzer.PrincipalAxis extends Object
Represents a principal axis containing the direction vector and associated variance (eigenvalue) from Principal Component Analysis.

Each principal axis represents a direction of variance in the analyzed data, with the primary axis having the highest variance, secondary axis the second highest, and tertiary axis the lowest.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
    The eigenvalue associated with this axis
    final double
    The X component of the axis direction
    final double
    The Y component of the axis direction
    final double
    The Z component of the axis direction
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getAngleWith(double[] directionComponents)
    Computes the acute angle between this principal axis and a direction vector.
    double
    getAngleWith(double dirX, double dirY, double dirZ)
    Computes the acute angle between this principal axis and a direction vector.
    double
     
    double
     
    double
    getVariancePercentage(double totalVariance)
    Computes the percentage of total variance explained by this principal axis.
    static double[]
    Computes the variance percentages for an array of principal axes.
    double
     
    double
     
    double
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public final double x
      The X component of the axis direction
    • y

      public final double y
      The Y component of the axis direction
    • z

      public final double z
      The Z component of the axis direction
    • eigenvalue

      public final double eigenvalue
      The eigenvalue associated with this axis
  • Method Details

    • getVariancePercentages

      public static double[] getVariancePercentages(PCAnalyzer.PrincipalAxis[] axes)
      Computes the variance percentages for an array of principal axes. This is a convenience method that returns the percentage of total variance explained by each principal axis, which is useful for understanding the overall shape variation along each axis.
      Parameters:
      axes - the array of three PrincipalAxis objects (primary, secondary, tertiary)
      Returns:
      array of three percentages (primary, secondary, tertiary) that sum to 100%, or null if axes is null
    • getX

      public double getX()
      Returns:
      the X component of the axis direction
    • getY

      public double getY()
      Returns:
      the Y component of the axis direction
    • getZ

      public double getZ()
      Returns:
      the Z component of the axis direction
    • getEigenvalue

      public double getEigenvalue()
      Returns:
      the eigenvalue (variance) associated with this axis
    • getVariance

      public double getVariance()
      Returns:
      the absolute variance along this axis
    • getVariancePercentage

      public double getVariancePercentage(double totalVariance)
      Computes the percentage of total variance explained by this principal axis.
      Parameters:
      totalVariance - the sum of all eigenvalues (total variance)
      Returns:
      the percentage of total variance explained by this axis (0-100%)
    • getAngleWith

      public double getAngleWith(double[] directionComponents)
      Computes the acute angle between this principal axis and a direction vector.
      Parameters:
      directionComponents - the 3-element array of the (X,Y,Z) components of the direction vector
      Returns:
      the acute angle in degrees (0-90°), or NaN if the direction vector has zero magnitude
    • getAngleWith

      public double getAngleWith(double dirX, double dirY, double dirZ)
      Computes the acute angle between this principal axis and a direction vector.
      Parameters:
      dirX - the X component of the direction vector
      dirY - the Y component of the direction vector
      dirZ - the Z component of the direction vector
      Returns:
      the acute angle in degrees (0-90°), or NaN if the direction vector has zero magnitude
    • toString

      public String toString()
      Overrides:
      toString in class Object