PadIfNeeded3D

Pads the sides of a 3D volume if its dimensions are less than specified minimum dimensions. If the pad_divisor_zyx is specified, the function additionally ensures that the volume dimensions are divisible by these values. Args: min_zyx (tuple[int, int, int] | None): Minimum desired size as (depth, height, width). Ensures volume dimensions are at least these values. If not specified, pad_divisor_zyx must be provided. pad_divisor_zyx (tuple[int, int, int] | None): If set, pads each dimension to make it divisible by corresponding value in format (depth_div, height_div, width_div). If not specified, min_zyx must be provided. position (Literal["center", "random"]): Position where the volume is to be placed after padding. Default is 'center'. fill (ColorType): Value to fill the border voxels for volume. Default: 0 fill_mask (ColorType): Value to fill the border voxels for masks. Default: 0 p (float): Probability of applying the transform. Default: 1.0 Targets: volume, mask3d, keypoints Image types: uint8, float32 Note: Input volume should be a numpy array with dimensions ordered as (z, y, x) or (depth, height, width), with optional channel dimension as the last axis.

Supported Targets

  • Volume
  • Mask3D
  • Keypoints

Parameters

min_zyx
Type: tuple[int, int, int] | NoneDefault: null
pad_divisor_zyx
Type: tuple[int, int, int] | NoneDefault: null
position
Type: Literal['center', 'random']Default: "center"
fill
Type: float | Sequence[float]Default: 0
fill_mask
Type: float | Sequence[float]Default: 0
p
Type: floatDefault: 1