Class PrincipalAxisEccentricity

Object
AnchorBean<Feature<FeatureInputSingleObject>>
InitializableBean<Feature<FeatureInputSingleObject>, FeatureInitialization>
Feature<FeatureInputSingleObject>
FeatureSingleObject
ImageMomentsBase
PrincipalAxisEccentricity

public class PrincipalAxisEccentricity extends ImageMomentsBase
Calculates the eccentricity of the Principal Axes (as defined by Image Moments).

Specifically, this is:

sqrt( 1 - eigenvalue2/eigenvalue1)
where eigenvalue1 is the eigen-value with first highest-magnitude, and eigenvalue2 is second-highest etc.

See Image moment on Wikipedia for the precise calculation.

Author:
Owen Feehan
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    calculateEccentricity(double eigenvalSmaller, double eigenvalLarger)
    Calculates the eccentricity from two eigenvalues.
    protected double
    calculateFromAllMoments(ImageMoments moments)
    Calculates the feature value from the ImageMoments.
    protected String
    Generates an error message when there are too few pixels to calculate moments.

    Methods inherited from class org.anchoranalysis.plugin.image.feature.bean.object.single.moments.ImageMomentsBase

    calculate, getValueIfTooFewVoxels, isSuppressZ, setSuppressZ, setValueIfTooFewVoxels

    Methods inherited from class org.anchoranalysis.image.feature.bean.object.single.FeatureSingleObject

    inputType

    Methods inherited from class org.anchoranalysis.feature.bean.Feature

    assignTo, beforeCalc, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, descriptionLong, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toString

    Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean

    getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized

    Methods inherited from class org.anchoranalysis.bean.AnchorBean

    checkMisconfigured, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise

    Methods inherited from class java.lang.Object

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

    • PrincipalAxisEccentricity

      public PrincipalAxisEccentricity()
  • Method Details

    • calculateEccentricity

      public static double calculateEccentricity(double eigenvalSmaller, double eigenvalLarger)
      Calculates the eccentricity from two eigenvalues.
      Parameters:
      eigenvalSmaller - the smaller eigenvalue
      eigenvalLarger - the larger eigenvalue
      Returns:
      the calculated eccentricity as a Double
    • calculateFromAllMoments

      protected double calculateFromAllMoments(ImageMoments moments) throws FeatureCalculationException
      Description copied from class: ImageMomentsBase
      Calculates the feature value from the ImageMoments.
      Specified by:
      calculateFromAllMoments in class ImageMomentsBase
      Parameters:
      moments - the ImageMoments to use for calculation
      Returns:
      the calculated feature value
      Throws:
      FeatureCalculationException - if the calculation fails
    • errorMessageIfTooFewPixels

      protected String errorMessageIfTooFewPixels()
      Description copied from class: ImageMomentsBase
      Generates an error message when there are too few pixels to calculate moments.
      Specified by:
      errorMessageIfTooFewPixels in class ImageMomentsBase
      Returns:
      the error message as a String