Class OverlappingObjects

Object
OverlappingObjects
All Implemented Interfaces:
Assignment<ObjectMask>

public class OverlappingObjects extends Object implements Assignment<ObjectMask>
Pairs an ObjectMask in one set with an ObjectMask in another, if deemed to overlap sufficiently.

The sets are termed left and right as arbitrary names.

Several statistics based upon overlap, the number of pairs, the number of unassigned objects are derived.

Author:
Owen Feehan
  • Constructor Details

    • OverlappingObjects

      public OverlappingObjects()
  • Method Details

    • createWithLeftUnassigned

      public static OverlappingObjects createWithLeftUnassigned(ObjectCollection objects)
      Creates with only left unassigned objects.
      Parameters:
      objects - the objects.
      Returns:
      a newly created OverlappingObjects.
    • createWithRight

      public static OverlappingObjects createWithRight(ObjectCollection objects)
      Creates with only right unassigned objects.
      Parameters:
      objects - the objects.
      Returns:
      a newly created OverlappingObjects.
    • statistics

      public StatisticsToExport statistics()
      Description copied from interface: Assignment
      The statistics associated with the assignment.
      Specified by:
      statistics in interface Assignment<ObjectMask>
      Returns:
      the statistics.
    • removeTouchingBorderXY

      public void removeTouchingBorderXY(Extent extent)
      Removes any objects from the assignment if they touch the X or Y scene border.
      Parameters:
      extent - the size of the scene, which determines its borders.
    • paired

      public List<ObjectMask> paired(boolean left)
      Description copied from interface: Assignment
      The items that are paired for a particular set.
      Specified by:
      paired in interface Assignment<ObjectMask>
      Parameters:
      left - if true, the left-set is considered, otherwise the right-set.
      Returns:
      a newly created list containing the paired items.
    • unassigned

      public List<ObjectMask> unassigned(boolean left)
      Description copied from interface: Assignment
      The items that are not paired for a particular set.
      Specified by:
      unassigned in interface Assignment<ObjectMask>
      Parameters:
      left - if true, the left-set is considered, otherwise the right-set.
      Returns:
      a newly created list containing the unpaired items for the respective set.
    • sumOverlapFromPaired

      public double sumOverlapFromPaired()
      Sums the overlap-ratio across all assigned pairs.
      Returns:
      the sum.
    • addUnassignedLeft

      public void addUnassignedLeft(ObjectMask object)
      Add an unassigned object to the left set.
      Parameters:
      object - the object to add.
    • addUnassignedLeft

      public void addUnassignedLeft(ObjectCollection objects)
      Add unassigned objects to the left set.
      Parameters:
      objects - the object to add.
    • addUnassignedRight

      public void addUnassignedRight(ObjectMask object)
      Add an unassigned object to the right set.
      Parameters:
      object - the object to add.
    • addUnassignedRight

      public void addUnassignedRight(ObjectCollection objects)
      Add unassigned objects to the right set.
      Parameters:
      objects - the object to add.
    • addAssignedPair

      public void addAssignedPair(ObjectMask object1, ObjectMask object2, double overlapRatio)
      Adds an assigned pair of objects with a particular overlap-ratio.
      Parameters:
      object1 - the left object.
      object2 - the right object.
      overlapRatio - the ratio of overlap between the two objects.
    • percentLeftAssigned

      public double percentLeftAssigned()
      The percentage of objects in the left set that have been paired.
      Returns:
      the percentage.
    • percentRightAssigned

      public double percentRightAssigned()
      The percentage of objects in the right set that have been paired.
      Returns:
      the percentage.
    • numberPaired

      public int numberPaired()
      Description copied from interface: Assignment
      The number of items that are paired.

      This is necessarily the same number for either set.

      Specified by:
      numberPaired in interface Assignment<ObjectMask>
      Returns:
      the total number of pairings.
    • numberUnassigned

      public int numberUnassigned(boolean left)
      Description copied from interface: Assignment
      The number of items in a particular set that are not paired.
      Specified by:
      numberUnassigned in interface Assignment<ObjectMask>
      Parameters:
      left - if true, the left-set is considered, otherwise the right-set.
      Returns:
      the number of unpaired items for the respective set.
    • numberUnassignedLeft

      public int numberUnassignedLeft()
      The number of unassigned objects in the left set.
      Returns:
      the number of unassigned objects.
    • numberUnassignedRight

      public int numberUnassignedRight()
      The number of unassigned objects in the right set.
      Returns:
      the number of unassigned objects.
    • leftSize

      public int leftSize()
      The total number of objects in the left set.
      Returns:
      the total number.
    • rightSize

      public int rightSize()
      The total number of objects in the right set.
      Returns:
      the total number.
    • getLeftUnassigned

      public List<ObjectMask> getLeftUnassigned()
      The unassigned objects in the left set.
    • getRightUnassigned

      public List<ObjectMask> getRightUnassigned()
      The unassigned objects in the right set.