Class OverlapFixer.Builder

java.lang.Object
qupath.lib.objects.utils.OverlapFixer.Builder
Enclosing class:
OverlapFixer

public static class OverlapFixer.Builder extends Object
Builder for the OverlapFixer.
  • Method Details

    • setMinArea

      public OverlapFixer.Builder setMinArea(double minArea)
      Set the minimum area for objects to be retained, in pixels. Objects with an area less than this (either before or after clipping) will be dropped.
      Parameters:
      minArea -
      Returns:
    • setComparator

      public OverlapFixer.Builder setComparator(Comparator<PathObject> comparator)
      Set the comparator to use for sorting objects. This assigns a 'priority' to objects, which is used to determine which objects are kept when overlaps occur. Objects that are sorted to be earlier in the list are considered to have a higher priority.
      Parameters:
      comparator -
      Returns:
    • sortBySolidity

      public OverlapFixer.Builder sortBySolidity()
      Set the comparator to sort by solidity, with the most solid objects given a higher priority. Subsequent sorting is by area, length, number of points, and finally by the default comparator.
      Returns:
    • sortByArea

      public OverlapFixer.Builder sortByArea()
      Set the comparator to sort by area, with the largest objects given a higher priority. Subsequent sorting is by length, number of points, and finally by the default comparator.
      Returns:
    • keepFragments

      public OverlapFixer.Builder keepFragments()
      Equivalent to keepFragments(true).
      Returns:
    • keepFragments

      public OverlapFixer.Builder keepFragments(boolean doKeep)
      Set whether to keep fragments when clipping objects. Fragments are defined as objects that are split into more pieces after clipping than they were before.
      Parameters:
      doKeep -
      Returns:
    • discardFragments

      public OverlapFixer.Builder discardFragments()
      Equivalent to keepFragments(false).
      Returns:
    • setStrategy

      public OverlapFixer.Builder setStrategy(OverlapFixer.Strategy strategy)
      Set the strategy for handling overlaps.
      Parameters:
      strategy -
      Returns:
    • clipOverlaps

      public OverlapFixer.Builder clipOverlaps()
      Clip overlapping objects, excluding the parts that overlap with a 'higher priority' object according to the comparator.
      Returns:
    • dropOverlaps

      public OverlapFixer.Builder dropOverlaps()
      Retain only the 'highest priority' objects when overlaps occur, and drop the others. Priority is determined by the comparator.
      Returns:
    • build

      public OverlapFixer build()
      Build the overlap fixer.
      Returns: