Class SegmentationBackedRegion

java.lang.Object
imagingbook.common.regions.BinaryRegion
imagingbook.common.regions.SegmentationBackedRegion
All Implemented Interfaces:
GenericProperties, Comparable<BinaryRegion>, Iterable<Pnt2d>

Defines a binary region that is backed by the label array of a region segmentation. A SegmentationBackedRegion instance does not have its own list or array of contained pixel coordinates but refers to the label array of the associated BinaryRegionSegmentation instance.
Version:
2020/12/21
  • Method Details

    • getLabel

      public int getLabel()
      Returns the label (number) of this region.
      Returns:
      the region label
    • getSize

      public int getSize()
      Description copied from class: BinaryRegion
      Get the size of this region.
      Specified by:
      getSize in class BinaryRegion
      Returns:
      the number of region points.
    • getX1Sum

      public long getX1Sum()
      Description copied from class: BinaryRegion
      Returns the sum of the x-coordinates of the points contained in this region.
      Specified by:
      getX1Sum in class BinaryRegion
      Returns:
      the sum of x-values.
    • getY1Sum

      public long getY1Sum()
      Description copied from class: BinaryRegion
      Returns the sum of the y-coordinates of the points contained in this region.
      Specified by:
      getY1Sum in class BinaryRegion
      Returns:
      the sum of y-values.
    • getX2Sum

      public long getX2Sum()
      Description copied from class: BinaryRegion
      Returns the sum of the squared x-coordinates of the points contained in this region.
      Specified by:
      getX2Sum in class BinaryRegion
      Returns:
      the sum of squared x-values.
    • getY2Sum

      public long getY2Sum()
      Description copied from class: BinaryRegion
      Returns the sum of the squared y-coordinates of the points contained in this region.
      Specified by:
      getY2Sum in class BinaryRegion
      Returns:
      the sum of squared y-values.
    • getXYSum

      public long getXYSum()
      Description copied from class: BinaryRegion
      Returns the sum of the mixed x*y-coordinates of the points contained in this region.
      Specified by:
      getXYSum in class BinaryRegion
      Returns:
      the sum of xy-values.
    • getBoundingBox

      Description copied from class: BinaryRegion
      Get the x/y axes-parallel bounding box as a rectangle (including the extremal coordinates).
      Specified by:
      getBoundingBox in class BinaryRegion
      Returns:
      the bounding box rectangle.
    • iterator

      public Iterator<Pnt2d> iterator()
    • getOuterContour

      Description copied from class: BinaryRegion
      Returns the (single) outer contour of this region if available, null otherwise. Points on an outer contour are arranged in clockwise order.
      Specified by:
      getOuterContour in class BinaryRegion
      Returns:
      the outer contour or null if not available
    • getInnerContours

      Description copied from class: BinaryRegion
      Get all inner contours of this region if available, null otherwise. Points on inner contours are arranged in counter-clockwise order.
      Specified by:
      getInnerContours in class BinaryRegion
      Returns:
      the (possibly empty) list of inner contours or null if not available
    • contains

      public boolean contains(int u, int v)
      Checks if the given pixel position is contained in this SegmentationBackedRegion instance.
      Specified by:
      contains in class BinaryRegion
      Parameters:
      u - x-coordinate
      v - y-coordinate
      Returns:
      true if (u,v) is contained in this region