3D single generator

class biapy.data.generators.single_data_3D_generator.Single3DImageDataGenerator(zflip=False, **kwars)[source]

Bases: SingleBaseDataGenerator

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.

ensure_shape(img)[source]
apply_transform(image)[source]

Transform the input image with one of the selected choices based on a probability.

Parameters:

image (3D/4D Numpy array) – Image to transform. E.g. (y, x, channels) in 2D or (z, y, x, channels) in 3D.

Returns:

image – Transformed image. E.g. (y, x, channels) in 2D or (z, y, x, channels) in 3D.

Return type:

3D/4D Numpy array

save_aug_samples(img, orig_images, i, pos, out_dir, draw_grid)[source]