biapy.data.generators.single_data_2D_generator

2D single image data generator for BiaPy.

This module provides the Single2DImageDataGenerator class, which generates batches of 2D images with on-the-fly augmentation for deep learning workflows.

class biapy.data.generators.single_data_2D_generator.Single2DImageDataGenerator(**kwars)[source]

Bases: SingleBaseDataGenerator

Custom 2D data generator to transform single image data.

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

Save transformed samples in order to check the generator.

Parameters:
  • img (3D Numpy array) – Image to use as sample. E.g. (y, x, channels)`.

  • orig_images (dict) – Dict where the original image is saved in “o_x”.

  • i (int) – Number of the sample within the transformed ones.

  • pos (int) – Number of the sample within the dataset.

  • out_dir (str) – Directory to save the images.

  • draw_grid (bool) – Whether to draw a grid or not.