3D pair generator
- class biapy.data.generators.pair_data_3D_generator.Pair3DImageDataGenerator(zflip=False, **kwars)[source]
Bases:
PairBaseDataGenerator
Custom 3D data generator based on imgaug and our own augmentors.py transformations. This generator will yield an image and its corresponding mask.
Based on microDL and Shervine’s blog.
- Parameters:
zflip (bool, optional) – To activate flips in z dimension.
- apply_transform(image, mask, e_im=None, e_mask=None)[source]
Transform the input image and its mask at the same time with one of the selected choices based on a probability.
- Parameters:
image (3D/4D Numpy array) – Image to transform. E.g.
(y, x, channels)
in2D
and(z, y, x, channels)
in3D
.mask (3D/4D Numpy array) – Mask to transform. E.g.
(y, x, channels)
in2D
and(z, y, x, channels)
in3D
.e_img (3D/4D Numpy array) – Extra image to help transforming
image
. E.g.(y, x, channels)
in2D
or(z, y, x, channels)
in3D
.e_mask (3D/4D Numpy array) – Extra mask to help transforming
mask
. E.g.(y, x, channels)
in2D
or(z, y, x, channels)
in3D
.
- Returns:
image (3D/4D Numpy array) – Transformed image. E.g.
(y, x, channels)
in2D
or(y, x, z, channels)
in3D
.mask (3D/4D Numpy array) – Transformed image mask. E.g.
(y, x, channels)
in2D
or(y, x, z, channels)
in3D
.