Class FeatureHistogramStatistic
Object
org.anchoranalysis.bean.AnchorBean<B>
org.anchoranalysis.bean.initializable.InitializableBean<Feature<T>,FeatureInitialization>
org.anchoranalysis.feature.bean.Feature<FeatureInputHistogram>
org.anchoranalysis.image.feature.bean.FeatureHistogram
org.anchoranalysis.image.feature.bean.histogram.FeatureHistogramStatistic
- Direct Known Subclasses:
Mean
public abstract class FeatureHistogramStatistic extends FeatureHistogram
Base class for
FeatureHistogram implementations that calculate a statistic from the
Histogram.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description FeatureHistogramStatistic() -
Method Summary
Modifier and Type Method Description doublecalculate(FeatureCalculationInput<FeatureInputHistogram> input)protected abstract doublecalculateStatisticFrom(org.anchoranalysis.math.histogram.Histogram histogram)Calculates the statistic from the histogram, that is subsequently returned as the feature-value.doublegetValueIfEmpty()The value to return iffexceptionifEmptyis false.booleanisExceptionIfEmpty()If true, then an exception is thrown if the histogram is empty, otherwisevalueIfEmptyis returned.voidsetExceptionIfEmpty(boolean exceptionIfEmpty)If true, then an exception is thrown if the histogram is empty, otherwisevalueIfEmptyis returned.voidsetValueIfEmpty(double valueIfEmpty)The value to return iffexceptionifEmptyis false.Methods inherited from class org.anchoranalysis.feature.bean.Feature
assignTo, beforeCalc, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, descriptionLong, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toStringMethods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitializedMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise
-
Constructor Details
-
FeatureHistogramStatistic
public FeatureHistogramStatistic()
-
-
Method Details
-
calculate
public double calculate(FeatureCalculationInput<FeatureInputHistogram> input) throws FeatureCalculationException- Specified by:
calculatein classFeature<FeatureInputHistogram>- Throws:
FeatureCalculationException
-
calculateStatisticFrom
protected abstract double calculateStatisticFrom(org.anchoranalysis.math.histogram.Histogram histogram) throws FeatureCalculationExceptionCalculates the statistic from the histogram, that is subsequently returned as the feature-value.- Parameters:
histogram- the histogram to calculate the statistic from.- Returns:
- the calculated statistic.
- Throws:
FeatureCalculationException- if the calculation cannot succeed.
-
isExceptionIfEmpty
public boolean isExceptionIfEmpty()If true, then an exception is thrown if the histogram is empty, otherwisevalueIfEmptyis returned. -
setExceptionIfEmpty
public void setExceptionIfEmpty(boolean exceptionIfEmpty)If true, then an exception is thrown if the histogram is empty, otherwisevalueIfEmptyis returned. -
getValueIfEmpty
public double getValueIfEmpty()The value to return iffexceptionifEmptyis false. -
setValueIfEmpty
public void setValueIfEmpty(double valueIfEmpty)The value to return iffexceptionifEmptyis false.
-