Class ImageMomentsBase

Object
org.anchoranalysis.bean.AnchorBean<B>
org.anchoranalysis.bean.initializable.InitializableBean<org.anchoranalysis.feature.bean.Feature<T>,​org.anchoranalysis.feature.initialization.FeatureInitialization>
org.anchoranalysis.feature.bean.Feature<org.anchoranalysis.image.feature.input.FeatureInputSingleObject>
org.anchoranalysis.image.feature.bean.object.single.FeatureSingleObject
org.anchoranalysis.plugin.image.feature.bean.object.single.moments.ImageMomentsBase
Direct Known Subclasses:
PrincipalAxisEccentricity, RatioPrincipalAxisLength, SpecificAxisBase

public abstract class ImageMomentsBase
extends org.anchoranalysis.image.feature.bean.object.single.FeatureSingleObject
A base class for features that are calculated using image-moments.

If there are too few voxels, then a constant value is returned.

Author:
Owen Feehan
See Also:
Image Moment on Wikipedia
  • Constructor Summary

    Constructors 
    Constructor Description
    ImageMomentsBase()  
  • Method Summary

    Modifier and Type Method Description
    double calculate​(org.anchoranalysis.feature.calculate.FeatureCalculationInput<org.anchoranalysis.image.feature.input.FeatureInputSingleObject> input)  
    protected abstract double calculateFromAllMoments​(org.anchoranalysis.math.statistics.moment.ImageMoments moments)
    Calculates the feature value from the ImageMoments.
    protected abstract String errorMessageIfTooFewPixels()
    Generates an error message when there are too few pixels to calculate moments.
    double getValueIfTooFewVoxels()
    A value to return if there are too few voxels (less than MIN_NUM_VOXELS) to calculate moments.
    boolean isSuppressZ()
    If true co-variance is suppressed in z-dimension.
    void setSuppressZ​(boolean suppressZ)
    If true co-variance is suppressed in z-dimension.
    void setValueIfTooFewVoxels​(double valueIfTooFewVoxels)
    A value to return if there are too few voxels (less than MIN_NUM_VOXELS) to calculate moments.

    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

  • Method Details

    • calculate

      public double calculate​(org.anchoranalysis.feature.calculate.FeatureCalculationInput<org.anchoranalysis.image.feature.input.FeatureInputSingleObject> input) throws org.anchoranalysis.feature.calculate.FeatureCalculationException
      Specified by:
      calculate in class org.anchoranalysis.feature.bean.Feature<org.anchoranalysis.image.feature.input.FeatureInputSingleObject>
      Throws:
      org.anchoranalysis.feature.calculate.FeatureCalculationException
    • calculateFromAllMoments

      protected abstract double calculateFromAllMoments​(org.anchoranalysis.math.statistics.moment.ImageMoments moments) throws org.anchoranalysis.feature.calculate.FeatureCalculationException
      Calculates the feature value from the ImageMoments.
      Parameters:
      moments - the ImageMoments to use for calculation
      Returns:
      the calculated feature value
      Throws:
      org.anchoranalysis.feature.calculate.FeatureCalculationException - if the calculation fails
    • errorMessageIfTooFewPixels

      protected abstract String errorMessageIfTooFewPixels() throws org.anchoranalysis.feature.calculate.FeatureCalculationException
      Generates an error message when there are too few pixels to calculate moments.
      Returns:
      the error message as a String
      Throws:
      org.anchoranalysis.feature.calculate.FeatureCalculationException - if generating the error message fails
    • isSuppressZ

      public boolean isSuppressZ()
      If true co-variance is suppressed in z-dimension.
    • setSuppressZ

      public void setSuppressZ​(boolean suppressZ)
      If true co-variance is suppressed in z-dimension.
    • getValueIfTooFewVoxels

      public double getValueIfTooFewVoxels()
      A value to return if there are too few voxels (less than MIN_NUM_VOXELS) to calculate moments.

      A warning message is also written to the log.

    • setValueIfTooFewVoxels

      public void setValueIfTooFewVoxels​(double valueIfTooFewVoxels)
      A value to return if there are too few voxels (less than MIN_NUM_VOXELS) to calculate moments.

      A warning message is also written to the log.