Class PairNeighbors
Creates a set of features, that creates pairs of neighboring-objects and applies a mixture of
single-object features and pair features.
Specifically:
- Creates a graph of neighboring-objects.
- Passes each pair of immediately-neighboring objects, together with their merged object, as an input.
Features are formed by duplicating the input-feature list (inputfeatures, single-object features only):
a) First.inputfeatures applies the features to the first-object in the pair b) Second.inputfeatures applies the features to the second-object in the pair c) Merged.inputfeatures applies the features to the merged-object
Features (that are not duplicated) are also possible:
d) Image. additional single-object features that don't depend on any individual-object, only the image
e) Pair. additional pair-features (FeatureInputPairObjects
)
The column order output is: Image, First, Second, Pair, Merged
For First
and Second
, we use a cache, to avoid repeated
calculations.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected BoundingBox
Creates a bounding-box that tightly fits the input to a particular table row (could be for one or more objects).createFeatures
(List<NamedBean<FeatureListProvider<FeatureInputSingleObject>>> list, NamedFeatureStoreFactory storeFactory, boolean suppressErrors) Creates features that will be applied on the objects.Additional features that only depend on the image, so do not need to be replicated for every object.Additional features that are processed on the pair of images (i.e.boolean
If true, no overlapping objects are treated as pairsboolean
isDo3D()
boolean
Include features for the First-object of the pairboolean
Include features for the Merged-object of the pairboolean
Include features for the Second-object of the pairSelects objects from an input that will be used for thumbnail generation.void
setAvoidOverlappingObjects
(boolean avoidOverlappingObjects) If true, no overlapping objects are treated as pairsvoid
setDo3D
(boolean do3D) void
setFeaturesImage
(List<NamedBean<FeatureListProvider<FeatureInputStack>>> featuresImage) Additional features that only depend on the image, so do not need to be replicated for every object.void
setFeaturesPair
(List<NamedBean<FeatureListProvider<FeatureInputPairObjects>>> featuresPair) Additional features that are processed on the pair of images (i.e.void
setIncludeFirst
(boolean includeFirst) Include features for the First-object of the pairvoid
setIncludeMerged
(boolean includeMerged) Include features for the Merged-object of the pairvoid
setIncludeSecond
(boolean includeSecond) Include features for the Second-object of the pairstartBatchDeriveInputs
(ObjectCollection objects, EnergyStack energyStack, Logger logger) Derives a list of inputs from an object-collection.Generates a unique identifier for a particular input.Methods inherited from class org.anchoranalysis.plugin.image.feature.bean.object.combine.CombineObjectsForFeatures
checkMisconfigured, deriveInputsStartBatch, getInterpolator, getThumbnail, setInterpolator, setThumbnail
Methods inherited from class org.anchoranalysis.bean.AnchorBean
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
PairNeighbors
public PairNeighbors()
-
-
Method Details
-
createFeatures
public FeatureTableCalculator<FeatureInputPairObjects> createFeatures(List<NamedBean<FeatureListProvider<FeatureInputSingleObject>>> list, NamedFeatureStoreFactory storeFactory, boolean suppressErrors) throws CreateException Description copied from class:CombineObjectsForFeatures
Creates features that will be applied on the objects. Features should always be duplicated from the input list.- Specified by:
createFeatures
in classCombineObjectsForFeatures<FeatureInputPairObjects>
- Parameters:
list
- 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.
-
startBatchDeriveInputs
public List<FeatureInputPairObjects> startBatchDeriveInputs(ObjectCollection objects, EnergyStack energyStack, Logger logger) throws CreateException Description copied from class:CombineObjectsForFeatures
Derives a list of inputs from an object-collection.- Specified by:
startBatchDeriveInputs
in classCombineObjectsForFeatures<FeatureInputPairObjects>
- 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
-
uniqueIdentifierFor
Description copied from class:CombineObjectsForFeatures
Generates a unique identifier for a particular input.- Specified by:
uniqueIdentifierFor
in classCombineObjectsForFeatures<FeatureInputPairObjects>
- Parameters:
input
- the input to generate a unique identifier for- Returns:
- a unique identifier string
-
objectsForThumbnail
Description copied from class:CombineObjectsForFeatures
Selects objects from an input that will be used for thumbnail generation.- Specified by:
objectsForThumbnail
in classCombineObjectsForFeatures<FeatureInputPairObjects>
- Parameters:
input
- the input- Returns:
- the
ObjectCollection
for thumbnail generation - Throws:
CreateException
- if there's an error creating the object collection
-
boundingBoxThatSpansInput
Description copied from class:CombineObjectsForFeatures
Creates a bounding-box that tightly fits the input to a particular table row (could be for one or more objects).- Specified by:
boundingBoxThatSpansInput
in classCombineObjectsForFeatures<FeatureInputPairObjects>
- Parameters:
input
- the input- Returns:
- a
BoundingBox
that fully fits around all objects used in input
-
getFeaturesPair
Additional features that are processed on the pair of images (i.e. First+Second as a pair) -
setFeaturesPair
public void setFeaturesPair(List<NamedBean<FeatureListProvider<FeatureInputPairObjects>>> featuresPair) Additional features that are processed on the pair of images (i.e. First+Second as a pair) -
getFeaturesImage
Additional features that only depend on the image, so do not need to be replicated for every object. -
setFeaturesImage
Additional features that only depend on the image, so do not need to be replicated for every object. -
isIncludeFirst
public boolean isIncludeFirst()Include features for the First-object of the pair -
setIncludeFirst
public void setIncludeFirst(boolean includeFirst) Include features for the First-object of the pair -
isIncludeSecond
public boolean isIncludeSecond()Include features for the Second-object of the pair -
setIncludeSecond
public void setIncludeSecond(boolean includeSecond) Include features for the Second-object of the pair -
isIncludeMerged
public boolean isIncludeMerged()Include features for the Merged-object of the pair -
setIncludeMerged
public void setIncludeMerged(boolean includeMerged) Include features for the Merged-object of the pair -
isAvoidOverlappingObjects
public boolean isAvoidOverlappingObjects()If true, no overlapping objects are treated as pairs -
setAvoidOverlappingObjects
public void setAvoidOverlappingObjects(boolean avoidOverlappingObjects) If true, no overlapping objects are treated as pairs -
isDo3D
public boolean isDo3D() -
setDo3D
public void setDo3D(boolean do3D)
-