Class SingleTableCalculator
Object
SingleTableCalculator
- All Implemented Interfaces:
FeatureCalculatorMulti<FeatureInputSingleObject>
,FeatureTableCalculator<FeatureInputSingleObject>
public class SingleTableCalculator
extends Object
implements FeatureTableCalculator<FeatureInputSingleObject>
A feature table calculator for single objects.
This class implements the FeatureTableCalculator
interface for FeatureInputSingleObject
, providing methods to calculate features for single objects and manage
the feature calculation process.
-
Constructor Summary
ConstructorsConstructorDescriptionSingleTableCalculator
(NamedFeatureStore<FeatureInputSingleObject> namedFeatureStore) Creates a newSingleTableCalculator
instance. -
Method Summary
Modifier and TypeMethodDescriptionCalculate the results of the features with a particular input.calculate
(FeatureInputSingleObject input, FeatureList<FeatureInputSingleObject> featuresSubset) Calculates the results of a subset of the features with a particular input.calculateSuppressErrors
(FeatureInputSingleObject input, ErrorReporter errorReporter) Calculates the results for aninput
recording the error to anErrorReporter
if anything goes wrong, but throwing no exception.Creates a list of names for each feature (columns of the table).Makes a copy of the feature-store for a new thread.int
The number of features that is calculated on each call toFeatureCalculatorMulti.calculate(T)
, and therefore the size of the returnedResultsVector
.void
start
(ImageInitialization initialization, Optional<EnergyStack> energyStack, Logger logger) Initializes a feature store that has the same structure as that previously created by createFeatures() from the same object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.anchoranalysis.feature.calculate.bound.FeatureCalculatorMulti
calculate
-
Constructor Details
-
SingleTableCalculator
Creates a newSingleTableCalculator
instance.- Parameters:
namedFeatureStore
- The named feature store containing features for single objects.
-
-
Method Details
-
start
public void start(ImageInitialization initialization, Optional<EnergyStack> energyStack, Logger logger) throws InitializeException Description copied from interface:FeatureTableCalculator
Initializes a feature store that has the same structure as that previously created by createFeatures() from the same object.- Specified by:
start
in interfaceFeatureTableCalculator<FeatureInputSingleObject>
- Parameters:
initialization
- the image initialization contextenergyStack
- an optional energy stack for feature calculationlogger
- a logger for reporting initialization progress or errors- Throws:
InitializeException
- if initialization fails
-
duplicateForNewThread
Description copied from interface:FeatureTableCalculator
Makes a copy of the feature-store for a new thread.Deep-copies the features. Shallow-copies everything else.
- Specified by:
duplicateForNewThread
in interfaceFeatureTableCalculator<FeatureInputSingleObject>
- Returns:
- the copied feature-store
-
calculate
public ResultsVector calculate(FeatureInputSingleObject input) throws NamedFeatureCalculateException Description copied from interface:FeatureCalculatorMulti
Calculate the results of the features with a particular input.- Specified by:
calculate
in interfaceFeatureCalculatorMulti<FeatureInputSingleObject>
- Parameters:
input
- the input to calculate.- Returns:
- the results of the calculation.
- Throws:
NamedFeatureCalculateException
- if any feature cannot be successfully calculated.
-
calculate
public ResultsVector calculate(FeatureInputSingleObject input, FeatureList<FeatureInputSingleObject> featuresSubset) throws NamedFeatureCalculateException Description copied from interface:FeatureCalculatorMulti
Calculates the results of a subset of the features with a particular input.- Specified by:
calculate
in interfaceFeatureCalculatorMulti<FeatureInputSingleObject>
- Parameters:
input
- the input to calculate.featuresSubset
- the subset of features (from those bound to the current instance) to calculate with.- Returns:
- the results of the calculation.
- Throws:
NamedFeatureCalculateException
- if any feature cannot be successfully calculated.
-
calculateSuppressErrors
public ResultsVector calculateSuppressErrors(FeatureInputSingleObject input, ErrorReporter errorReporter) Description copied from interface:FeatureCalculatorMulti
Calculates the results for aninput
recording the error to anErrorReporter
if anything goes wrong, but throwing no exception.- Specified by:
calculateSuppressErrors
in interfaceFeatureCalculatorMulti<FeatureInputSingleObject>
- Parameters:
input
- the input to calculate.errorReporter
- where errors are recorded.- Returns:
- the results of the calculation.
-
sizeFeatures
public int sizeFeatures()Description copied from interface:FeatureCalculatorMulti
The number of features that is calculated on each call toFeatureCalculatorMulti.calculate(T)
, and therefore the size of the returnedResultsVector
.- Specified by:
sizeFeatures
in interfaceFeatureCalculatorMulti<FeatureInputSingleObject>
- Returns:
- the number of features.
-
createFeatureNames
Description copied from interface:FeatureTableCalculator
Creates a list of names for each feature (columns of the table).- Specified by:
createFeatureNames
in interfaceFeatureTableCalculator<FeatureInputSingleObject>
- Returns:
- the list of feature names
-