Package sc.fiji.snt.analysis
Class PCAnalyzer.PrincipalAxis
java.lang.Object
sc.fiji.snt.analysis.PCAnalyzer.PrincipalAxis
- Enclosing class:
PCAnalyzer
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
FieldsModifier and TypeFieldDescriptionfinal doubleThe eigenvalue associated with this axisfinal doubleThe X component of the axis directionfinal doubleThe Y component of the axis directionfinal doubleThe Z component of the axis direction -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAngleWith(double[] directionComponents) Computes the acute angle between this principal axis and a direction vector.doublegetAngleWith(double dirX, double dirY, double dirZ) Computes the acute angle between this principal axis and a direction vector.doubledoubledoublegetVariancePercentage(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.doublegetX()doublegetY()doublegetZ()toString()
-
Field Details
-
x
public final double xThe X component of the axis direction -
y
public final double yThe Y component of the axis direction -
z
public final double zThe Z component of the axis direction -
eigenvalue
public final double eigenvalueThe eigenvalue associated with this axis
-
-
Method Details
-
getVariancePercentages
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 vectordirY- the Y component of the direction vectordirZ- 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
-