AlbumentationsExplore
DocumentationExploreAdoptionPricingBlog
GitHub

Flip3D

Targets:
volume
mask3d
keypoints
Image Types:uint8, float32

Reflect a volume independently across depth, height, and width voxel-index axes while retaining its shape and channel layout.

In random mode, each allowed axis is independently reflected, including the empty subset (identity). This samples the full reflection group uniformly. Set flip_axes to a fixed subset, including (), for reversible test-time augmentation; reflections are self-inverse. This is a voxel-index reflection only: it does not update affine metadata or perform a physical-space reorientation.

Arguments
axes
tuple[[0, 1, 2], ...]
[0, 1, 2]

Non-empty spatial axes that random mode may flip, in (depth, height, width) order. Default: (0, 1, 2).

flip_axes
tuple[[0, 1, 2], ...] | None

Fixed subset of axes to reflect for deterministic test-time augmentation. Use () for identity. Default: None.

p
float
1

Probability of applying the transform. Default: 1.0.

Examples
>>> import numpy as np
>>> import albumentations as A
>>> volume = np.arange(2 * 3 * 5, dtype=np.uint8).reshape(2, 3, 5, 1)
>>> transform = A.Flip3D(flip_axes=(0, 2), p=1.0)
>>> result = transform(volume=volume)
>>> result["volume"].shape
(2, 3, 5, 1)
Notes
  • A realized reflection across an odd number of axes emits the Flip3D label-mapping event. Its semantic-mask mapping applies only to mask3d; keypoint label mappings rename label values without changing coordinate-row order.
  • A reflection across an even number of axes, including identity, preserves orientation and does not emit this event. Without an explicit mapping, labels stay unchanged.
See Also
  • Affine3D: Use positive scales and continuous rotations or translations without sampling reflections.