Class PairNeighbors

Object
AnchorBean<CombineObjectsForFeatures<FeatureInputPairObjects>>
CombineObjectsForFeatures<FeatureInputPairObjects>
PairNeighbors

public class PairNeighbors extends CombineObjectsForFeatures<FeatureInputPairObjects>
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected BoundingBox
    boundingBoxThatSpansInput(FeatureInputPairObjects input)
    Creates a bounding-box that tightly fits the input to a particular table row (could be for one or more objects).
    FeatureTableCalculator<FeatureInputPairObjects>
    createFeatures(List<NamedBean<FeatureListProvider<FeatureInputSingleObject>>> list, NamedFeatureStoreFactory storeFactory, boolean suppressErrors)
    Creates features that will be applied on the objects.
    List<NamedBean<FeatureListProvider<FeatureInputStack>>>
    Additional features that only depend on the image, so do not need to be replicated for every object.
    List<NamedBean<FeatureListProvider<FeatureInputPairObjects>>>
    Additional features that are processed on the pair of images (i.e.
    boolean
    If true, no overlapping objects are treated as pairs
    boolean
     
    boolean
    Include features for the First-object of the pair
    boolean
    Include features for the Merged-object of the pair
    boolean
    Include features for the Second-object of the pair
    ObjectCollection
    objectsForThumbnail(FeatureInputPairObjects input)
    Selects objects from an input that will be used for thumbnail generation.
    void
    setAvoidOverlappingObjects(boolean avoidOverlappingObjects)
    If true, no overlapping objects are treated as pairs
    void
    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 pair
    void
    setIncludeMerged(boolean includeMerged)
    Include features for the Merged-object of the pair
    void
    setIncludeSecond(boolean includeSecond)
    Include features for the Second-object of the pair
    List<FeatureInputPairObjects>
    startBatchDeriveInputs(ObjectCollection objects, EnergyStack energyStack, Logger logger)
    Derives a list of inputs from an object-collection.
    uniqueIdentifierFor(FeatureInputPairObjects input)
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 class CombineObjectsForFeatures<FeatureInputPairObjects>
      Parameters:
      list - beans defining features to be applied to single-objects.
      storeFactory - creates a new NamedFeatureStore 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 from featuresSingleObject.
      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 class CombineObjectsForFeatures<FeatureInputPairObjects>
      Parameters:
      objects - the object-collection
      energyStack - energy-stack used during feature calculation
      logger - the logger
      Returns:
      the list of inputs
      Throws:
      CreateException - if there's an error deriving the inputs
    • uniqueIdentifierFor

      public String uniqueIdentifierFor(FeatureInputPairObjects input)
      Description copied from class: CombineObjectsForFeatures
      Generates a unique identifier for a particular input.
      Specified by:
      uniqueIdentifierFor in class CombineObjectsForFeatures<FeatureInputPairObjects>
      Parameters:
      input - the input to generate a unique identifier for
      Returns:
      a unique identifier string
    • objectsForThumbnail

      public ObjectCollection objectsForThumbnail(FeatureInputPairObjects input) throws CreateException
      Description copied from class: CombineObjectsForFeatures
      Selects objects from an input that will be used for thumbnail generation.
      Specified by:
      objectsForThumbnail in class CombineObjectsForFeatures<FeatureInputPairObjects>
      Parameters:
      input - the input
      Returns:
      the ObjectCollection for thumbnail generation
      Throws:
      CreateException - if there's an error creating the object collection
    • boundingBoxThatSpansInput

      protected BoundingBox boundingBoxThatSpansInput(FeatureInputPairObjects input)
      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 class CombineObjectsForFeatures<FeatureInputPairObjects>
      Parameters:
      input - the input
      Returns:
      a BoundingBox that fully fits around all objects used in input
    • getFeaturesPair

      public List<NamedBean<FeatureListProvider<FeatureInputPairObjects>>> 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

      public List<NamedBean<FeatureListProvider<FeatureInputStack>>> getFeaturesImage()
      Additional features that only depend on the image, so do not need to be replicated for every object.
    • setFeaturesImage

      public 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.
    • 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)