Class CombineObjectsForFeatures<T extends FeatureInput>
- Type Parameters:
T
- type of feature used in the table
- Direct Known Subclasses:
EachObjectIndependently
,PairNeighbors
public abstract class CombineObjectsForFeatures<T extends FeatureInput>
extends AnchorBean<CombineObjectsForFeatures<T>>
A way to combine (or not combine) objects so that they provide a feature-table.
Columns in the feature-table always represent features.
A row may represent a single object, or a pair of objects, or any other derived inputs from an object-collection, depending on the implementation of the sub-class.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CombineObjectsForFeatures
(Interpolator interpolator) Create with a specific interpolator. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract BoundingBox
boundingBoxThatSpansInput
(T input) Creates a bounding-box that tightly fits the input to a particular table row (could be for one or more objects).void
checkMisconfigured
(BeanInstanceMap defaultInstances) Checks if the bean is misconfigured and saves the default instances for later use.abstract FeatureTableCalculator
<T> createFeatures
(List<NamedBean<FeatureListProvider<FeatureInputSingleObject>>> featuresSingleObject, NamedFeatureStoreFactory storeFactory, boolean suppressErrors) Creates features that will be applied on the objects.deriveInputsStartBatch
(ObjectCollection objects, EnergyStack energyStack, boolean thumbnailsEnabled, OperationContext context) Derives a list of inputs (i.e. rows in a feature table) and starts a batch of related thumbnail generation.Interpolator used to resize images in thumbnail generation.Generates a thumbnail representation of one or more combined objects, as form a single input.abstract ObjectCollection
objectsForThumbnail
(T input) Selects objects from an input that will be used for thumbnail generation.void
setInterpolator
(Interpolator interpolator) Interpolator used to resize images in thumbnail generation.void
setThumbnail
(ThumbnailFromObjects thumbnail) Generates a thumbnail representation of one or more combined objects, as form a single input.startBatchDeriveInputs
(ObjectCollection objects, EnergyStack energyStack, Logger logger) Derives a list of inputs from an object-collection.abstract String
uniqueIdentifierFor
(T input) Generates a unique identifier for a particular input.Methods inherited from class org.anchoranalysis.bean.AnchorBean
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
CombineObjectsForFeatures
Create with a specific interpolator.- Parameters:
interpolator
- interpolator used to resize images in thumbnail generation.
-
CombineObjectsForFeatures
public CombineObjectsForFeatures()
-
-
Method Details
-
checkMisconfigured
Checks if the bean is misconfigured and saves the default instances for later use.- Overrides:
checkMisconfigured
in classAnchorBean<CombineObjectsForFeatures<T extends FeatureInput>>
- Parameters:
defaultInstances
- theBeanInstanceMap
containing default instances- Throws:
BeanMisconfiguredException
- if the bean is misconfigured
-
createFeatures
public abstract FeatureTableCalculator<T> createFeatures(List<NamedBean<FeatureListProvider<FeatureInputSingleObject>>> featuresSingleObject, NamedFeatureStoreFactory storeFactory, boolean suppressErrors) throws CreateException, InitializeException Creates features that will be applied on the objects. Features should always be duplicated from the input list.- Parameters:
featuresSingleObject
- beans defining features to be applied to single-objects.storeFactory
- creates a newNamedFeatureStore
as needed.suppressErrors
- when true, exceptions aren't thrown when feature-calculations fail, but rather a log error message is written.- Returns:
- a
FeatureTableCalculator
for feature tables that may apply various features derived fromfeaturesSingleObject
. - Throws:
CreateException
- if there's an error creating the features.InitializeException
- if there's an error initializing the features.
-
uniqueIdentifierFor
Generates a unique identifier for a particular input.- Parameters:
input
- the input to generate a unique identifier for- Returns:
- a unique identifier string
-
deriveInputsStartBatch
public ListWithThumbnails<T,ObjectCollection> deriveInputsStartBatch(ObjectCollection objects, EnergyStack energyStack, boolean thumbnailsEnabled, OperationContext context) throws CreateException Derives a list of inputs (i.e. rows in a feature table) and starts a batch of related thumbnail generation.- Parameters:
objects
- the objects from which inputs are derived.energyStack
- energy-stack used during feature calculation.thumbnailsEnabled
- whether thumbnail-generation is enabled.context
- context in which the operation occurs.- Returns:
- the list of inputs.
- Throws:
CreateException
- if an error occurs deriving or creating the thumbnails.
-
objectsForThumbnail
Selects objects from an input that will be used for thumbnail generation.- Parameters:
input
- the input- Returns:
- the
ObjectCollection
for thumbnail generation - Throws:
CreateException
- if there's an error creating the object collection
-
startBatchDeriveInputs
protected abstract List<T> startBatchDeriveInputs(ObjectCollection objects, EnergyStack energyStack, Logger logger) throws CreateException Derives a list of inputs from an object-collection.- Parameters:
objects
- the object-collectionenergyStack
- energy-stack used during feature calculationlogger
- the logger- Returns:
- the list of inputs
- Throws:
CreateException
- if there's an error deriving the inputs
-
boundingBoxThatSpansInput
Creates a bounding-box that tightly fits the input to a particular table row (could be for one or more objects).- Parameters:
input
- the input- Returns:
- a
BoundingBox
that fully fits around all objects used in input
-
getThumbnail
Generates a thumbnail representation of one or more combined objects, as form a single input.If not set, a thumbnail will be created with an outline around selected and unselected objects.
-
setThumbnail
Generates a thumbnail representation of one or more combined objects, as form a single input.If not set, a thumbnail will be created with an outline around selected and unselected objects.
-
getInterpolator
Interpolator used to resize images in thumbnail generation. -
setInterpolator
Interpolator used to resize images in thumbnail generation.
-