Class Padding

java.lang.Object
qupath.lib.regions.Padding

public class Padding extends Object
Requested padding for a 2D image.
Author:
Pete Bankhead
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Padding padding)
    Add this padding to another.
    static Padding
    Get an empty padding object (0 on all sides).
    static Padding
    getPadding(int x, int y)
    Get an padding object 'x' pixels to the left and right, and 'y' pixels above and below.
    static Padding
    getPadding(int x1, int x2, int y1, int y2)
    Get a padding object that may have different padding on each side.
    int
    Get the first horizontal padding (left of the image), in pixels.
    int
    Get the second horizontal padding (right of the image), in pixels.
    int
    Get the total horizontal padding (sum of x1 and x2).
    int
    Get the first vertical padding (top of the image), in pixels.
    int
    Get the second vertical padding (bottom of the image), in pixels.
    int
    Get the total vertical padding (sum of x1 and x2).
    boolean
    Returns true of the padding is zero.
    boolean
    Returns true of the padding is identical on all sides (x1 == x2 == y1 == y2).
    max(Padding padding)
    Compare two paddings, and take the larger padding value on all sides.
    subtract(Padding padding)
    Add another padding from this one.
    static Padding
    symmetric(int pad)
    Get a padding object with 'pad' pixels on all sides.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • getX1

      public int getX1()
      Get the first horizontal padding (left of the image), in pixels.
      Returns:
    • getX2

      public int getX2()
      Get the second horizontal padding (right of the image), in pixels.
      Returns:
    • getXSum

      public int getXSum()
      Get the total horizontal padding (sum of x1 and x2).
      Returns:
    • getY1

      public int getY1()
      Get the first vertical padding (top of the image), in pixels.
      Returns:
    • getY2

      public int getY2()
      Get the second vertical padding (bottom of the image), in pixels.
      Returns:
    • getYSum

      public int getYSum()
      Get the total vertical padding (sum of x1 and x2).
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isSymmetric

      public boolean isSymmetric()
      Returns true of the padding is identical on all sides (x1 == x2 == y1 == y2).
      Returns:
    • isEmpty

      public boolean isEmpty()
      Returns true of the padding is zero.
      Returns:
    • add

      public Padding add(Padding padding)
      Add this padding to another. This padding is unchanged.
      Parameters:
      padding -
      Returns:
      a Padding where the padding on all sides is the sum of the corresponding padding of both objects.
    • subtract

      public Padding subtract(Padding padding)
      Add another padding from this one. This padding is unchanged.
      Parameters:
      padding -
      Returns:
      a Padding where the padding on all sides is result of subtracting another padding from this one. Note that all values from the padding being subtracted must be ≤ the corresponding values of this padding.
    • max

      public Padding max(Padding padding)
      Compare two paddings, and take the larger padding value on all sides.
      Parameters:
      padding -
      Returns:
    • symmetric

      public static Padding symmetric(int pad)
      Get a padding object with 'pad' pixels on all sides.
      Parameters:
      pad - the padding for x1, x2, y1 and y2
      Returns:
    • getPadding

      public static Padding getPadding(int x, int y)
      Get an padding object 'x' pixels to the left and right, and 'y' pixels above and below.
      Parameters:
      x - the padding for x1 and x2
      y - the padding for y1 and y2
      Returns:
    • empty

      public static Padding empty()
      Get an empty padding object (0 on all sides).
      Returns:
    • getPadding

      public static Padding getPadding(int x1, int x2, int y1, int y2)
      Get a padding object that may have different padding on each side.
      Parameters:
      x1 -
      x2 -
      y1 -
      y2 -
      Returns: