biapy.data.generators.pair_data_2D_generator
2D paired image and mask data generator for BiaPy.
This module provides the Pair2DImageDataGenerator class, which generates batches of 2D images and their corresponding masks with on-the-fly augmentation.
- class biapy.data.generators.pair_data_2D_generator.Pair2DImageDataGenerator(**kwars)[source]
Bases:
PairBaseDataGeneratorCustom 2D data generator to transform paired image and mask data.
- save_aug_samples(img: ndarray[tuple[int, ...], dtype[_ScalarType_co]], mask: ndarray[tuple[int, ...], dtype[_ScalarType_co]], orig_images: Dict, i: int, pos: int, out_dir: str, point_dict: Dict)[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).mask (3D Numpy array) – Mask to use as sample. E.g.
(y, x, channels).orig_images (dict) – Dict where the original image and mask are saved in “o_x” and “o_y”, respectively.
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.
point_dict (Dict) – Necessary info to draw the patch extracted within the original image. It has
oxandoyrepresenting thexandycoordinates of the central point selected during the crop extraction, ands_xands_yas the(0,0)coordinates of the extracted patch.