Package qupath.lib.regions
Class Padding
java.lang.Object
qupath.lib.regions.Padding
Requested padding for a 2D image.
-
Method Summary
Modifier and TypeMethodDescriptionAdd this padding to another.static Paddingempty()Get an empty padding object (0 on all sides).static PaddinggetPadding(int x, int y) Get an padding object 'x' pixels to the left and right, and 'y' pixels above and below.static PaddinggetPadding(int x1, int x2, int y1, int y2) Get a padding object that may have different padding on each side.intgetX1()Get the first horizontal padding (left of the image), in pixels.intgetX2()Get the second horizontal padding (right of the image), in pixels.intgetXSum()Get the total horizontal padding (sum of x1 and x2).intgetY1()Get the first vertical padding (top of the image), in pixels.intgetY2()Get the second vertical padding (bottom of the image), in pixels.intgetYSum()Get the total vertical padding (sum of x1 and x2).booleanisEmpty()Returns true of the padding is zero.booleanReturns true of the padding is identical on all sides (x1 == x2 == y1 == y2).Compare two paddings, and take the larger padding value on all sides.Add another padding from this one.static Paddingsymmetric(int pad) Get a padding object with 'pad' pixels on all sides.toString()
-
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
-
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
Add this padding to another. This padding is unchanged.- Parameters:
padding-- Returns:
- a
Paddingwhere the padding on all sides is the sum of the corresponding padding of both objects.
-
subtract
Add another padding from this one. This padding is unchanged.- Parameters:
padding-- Returns:
- a
Paddingwhere 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
Compare two paddings, and take the larger padding value on all sides.- Parameters:
padding-- Returns:
-
symmetric
Get a padding object with 'pad' pixels on all sides.- Parameters:
pad- the padding for x1, x2, y1 and y2- Returns:
-
getPadding
Get an padding object 'x' pixels to the left and right, and 'y' pixels above and below.- Parameters:
x- the padding for x1 and x2y- the padding for y1 and y2- Returns:
-
empty
Get an empty padding object (0 on all sides).- Returns:
-
getPadding
Get a padding object that may have different padding on each side.- Parameters:
x1-x2-y1-y2-- Returns:
-