Class RegionBoundaries

java.lang.Object
inra.ijpb.measure.region2d.RegionBoundaries

public class RegionBoundaries
extends java.lang.Object
Utility functions for computing position of boundary points/corners of regions within binary or label images. The methods in this class are mostly used for computing convex hulls.
Author:
dlegland
See Also:
Convexity
  • Method Summary

    Modifier and Type Method Description
    static java.util.ArrayList<java.awt.geom.Point2D> boundaryPixelsMiddleEdges​(ij.process.ImageProcessor binaryImage)
    Extracts boundary points from a binary region, keeping middle points of pixel edges.
    static java.util.ArrayList<java.awt.geom.Point2D>[] boundaryPixelsMiddleEdges​(ij.process.ImageProcessor labelImage, int[] labels)
    Extracts boundary points from the different regions.
    static java.util.ArrayList<java.awt.geom.Point2D>[] runlengthsCorners​(ij.process.ImageProcessor image, int[] labels)
    Returns a set of points located at the corners of a binary particle.
    static java.util.ArrayList<java.awt.geom.Point2D> runLengthsCorners​(ij.process.ImageProcessor image)
    Returns a set of points located at the corners of a binary particle.
    static java.util.Map<java.lang.Integer,​java.util.ArrayList<java.awt.geom.Point2D>> runLengthsCornersMap​(ij.process.ImageProcessor image, int[] labels)
    Returns a set of points located at the corners of each region.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • runLengthsCorners

      public static final java.util.ArrayList<java.awt.geom.Point2D> runLengthsCorners​(ij.process.ImageProcessor image)
      Returns a set of points located at the corners of a binary particle. Point coordinates are integer (ImageJ locates pixels in a [0 1]^d area).
      Parameters:
      image - a binary image representing the particle
      Returns:
      a list of points that can be used for convex hull computation
    • runlengthsCorners

      public static final java.util.ArrayList<java.awt.geom.Point2D>[] runlengthsCorners​(ij.process.ImageProcessor image, int[] labels)
      Returns a set of points located at the corners of a binary particle. Point coordinates are integer (ImageJ locates pixels in a [0 1]^d area). This methods computes the results as a Map, and converts the result into an array.
      Parameters:
      image - a binary image representing the particle
      labels - the list of labels to process
      Returns:
      for each label, an array of points
      See Also:
      runLengthsCornersMap(ImageProcessor, int[])
    • runLengthsCornersMap

      public static final java.util.Map<java.lang.Integer,​java.util.ArrayList<java.awt.geom.Point2D>> runLengthsCornersMap​(ij.process.ImageProcessor image, int[] labels)
      Returns a set of points located at the corners of each region. Point coordinates are integer (ImageJ locates pixels in a [0 1]^2 area).
      Parameters:
      image - a binary image representing the particle
      labels - the list of labels to process
      Returns:
      a list of points that can be used for convex hull computation
      See Also:
      runlengthsCorners(ImageProcessor, int[])
    • boundaryPixelsMiddleEdges

      public static final java.util.ArrayList<java.awt.geom.Point2D> boundaryPixelsMiddleEdges​(ij.process.ImageProcessor binaryImage)
      Extracts boundary points from a binary region, keeping middle points of pixel edges. This method considers middle points of pixel edges, assuming a "diamond shape" for pixels. For a single pixel (x,y), ImageJ considers equivalent area to be [x,x+1[ x [y,y+1[, and pixel center at (x+0.5, y+0.5). The boundaries extracted by this methods have following coordinates:
      • (x+0.5, y): top boundary
      • (x , y+0.5): left boundary
      • (x+1 , y+0.5): right boundary
      • (x+0.5, y+1): bottom boundary
      Parameters:
      binaryImage - the image processor containing the binary region
      Returns:
      an array of Point2D, located on the boundary of the region.
    • boundaryPixelsMiddleEdges

      public static final java.util.ArrayList<java.awt.geom.Point2D>[] boundaryPixelsMiddleEdges​(ij.process.ImageProcessor labelImage, int[] labels)
      Extracts boundary points from the different regions. This method considers middle points of pixel edges, assuming a "diamond shape" for pixels. For a single pixel (x,y), ImageJ considers equivalent area to be [x,x+1[ x [y,y+1[, and pixel center at (x+0.5, y+0.5). The boundaries extracted by this methods have following coordinates:
      • (x+0.5, y): top boundary
      • (x , y+0.5): left boundary
      • (x+1 , y+0.5): right boundary
      • (x+0.5, y+1): bottom boundary
      Parameters:
      labelImage - the image processor containing the region labels
      labels - the array of region labels
      Returns:
      an array of arrays of boundary points, one array for each label.