Package qupath.lib.regions
Class Padding
java.lang.Object
qupath.lib.regions.Padding
Requested padding for a 2D image.
- Author:
- Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptionAdd this padding to another.static Padding
empty()
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
getX1()
Get the first horizontal padding (left of the image), in pixels.int
getX2()
Get the second horizontal padding (right of the image), in pixels.int
getXSum()
Get the total horizontal padding (sum of x1 and x2).int
getY1()
Get the first vertical padding (top of the image), in pixels.int
getY2()
Get the second vertical padding (bottom of the image), in pixels.int
getYSum()
Get the total vertical padding (sum of x1 and x2).boolean
isEmpty()
Returns true of the padding is zero.boolean
Returns 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 Padding
symmetric
(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
Padding
where 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
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
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:
-