volumentations_biomedicine.augmentations.transforms module

class volumentations_biomedicine.augmentations.transforms.AffineTransform(angle_limit: List[Union[Tuple[float], float]] = [15, 15, 15], translantion_limit: Optional[List[Union[Tuple[int], int]]] = None, scaling_coef: Optional[List] = None, scale_back: bool = True, interpolation: int = 1, border_mode: str = 'reflect', ival: float = 0, mval: float = 0, ignore_index: Optional[float] = None, always_apply: bool = False, p: float = 0.5)[source]

Bases: DualTransform

Rotation around spatial axes.

Rotation around each axis is chosen randomly from given interval in angle_limit. If a float X is given instead of for given axis then it becomes interval [-X, X]. If scaling_coef is used, it should be list with length equal 3. For closer clook at the interpolation, border_mode, ival and mval take a look at the scipy.ndimage.affine_transform.

Parameters:
  • angle_limit (List[Tuple[float] | float], optional) – Contains intervals in degrees from which angle of rotation is chosen, for corresponding axis. Defaults to [(-15, 15),(-15, 15),(-15, 15)].

  • translantion_limit (List[Tuple[int], | int] | None, optional) – List of length equal to the number of axes -1 (minus channel), each element controls translation in this axis. This list consists of intervals, from which, it is then randomly chosen the translation vector. Defaults to None.

  • scaling_coef (List[float] | None, optional) – List which contains scaling coefficients to make the image data isotropic in spatial dimensions. Length of list needs to be 3(number of spatial axes) as only spatial dimensions are scaled. If scaling_coef is set to None, there is no scalling. Recommended for anisotropic data and if one of spatial axis have significantly lower amount of samples. Defaults to None.

  • scale_back (bool, optional) – If scaling_coef is not None, then image is scaled back, to be anisotropic. Defaults to True.

  • interpolation (Int, optional) – The order of spline interpolation. Defaults to 1.

  • border_mode (str, optional) – The mode parameter determines how the input array is extended beyond its boundaries. Defaults to ‘constant’.

  • ival (float, optional) – Value to fill past edges of image if mode is ‘constant’. Defaults to 0.

  • mval (float, optional) – Value to fill past edges of mask if mode is ‘constant’. Defaults to 0.

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image, mask

Image types:

float32

apply(img, x, y, z, translate)[source]
apply_to_mask(mask, x, y, z, translate)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.CenterCrop(shape: Tuple[int], border_mode: str = 'reflect', ival: Union[Sequence[float], float] = (0, 0), mval: Union[Sequence[float], float] = (0, 0), ignore_index: Optional[float] = None, always_apply: bool = False, p: float = 1.0)[source]

Bases: DualTransform

Crops center region of the input. Size of this crop is given by shape.

Unlike CenterCrop from Albumentations, this transform pads the input in dimensions where the input is smaller than the crop-shape with numpy.pad, for which are border_mode, ival and mval.

https://numpy.org/doc/stable/reference/generated/numpy.pad.html

Parameters:
  • shape (Tuple[int]) Final shape of input, expected without first axis of image (representing channels) –

  • border_mode (str, optional) – border mode used for numpy.pad. Defaults to “reflect”.

  • ival (Tuple[float], optional) – values used for ‘constant’ or ‘linear_ramp’ for image. Defaults to (0, 0).

  • mval (Tuple[float], optional) – values used for ‘constant’ or ‘linear_ramp’ for mask. Defaults to (0, 0).

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image, mask

Image types:

float32

apply(img)[source]
apply_to_mask(mask)[source]
class volumentations_biomedicine.augmentations.transforms.Contiguous(always_apply=False, p=0.5)[source]

Bases: DualTransform

apply(image)[source]
class volumentations_biomedicine.augmentations.transforms.ElasticTransform(deformation_limits=(0, 0.25), interpolation=1, border_mode='constant', value=0, mask_value=0, always_apply=False, p=0.5)[source]

Bases: DualTransform

apply(img, sigmas, alphas, random_state=None)[source]
apply_to_mask(img, sigmas, alphas, random_state=None)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.Flip(axes: List[int] = [1, 2, 3], always_apply=False, p=1)[source]

Bases: DualTransform

Flips input around specified axes.

Parameters:
  • axes (List[int], optional) – List of axes around which is flip done. Defaults to [1,2,3].

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image, mask

Image types:

float32

apply(img, axes)[source]
apply_to_mask(mask, axes)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.Float(always_apply=False, p=0.5)[source]

Bases: DualTransform

apply(image)[source]
class volumentations_biomedicine.augmentations.transforms.GaussianBlur(sigma: Union[float, Tuple[float], List[Union[Tuple[float], float]]] = 0.8, border_mode: str = 'reflect', cval: float = 0, always_apply: bool = False, p: float = 0.5)[source]

Bases: ImageOnlyTransform

Performs gaussian blur on the image.

Sigma parameter determines the strength of gaussian blur. There is no blurring between channels. By default there is no blurring also on time dimension. If given single number, channels and axes are blurred with same strength. If given tuple, blurring is performed with same effect over channels, but on each axis differently. If given List, each channel is blurred differently, according to the element inside list.

For more information about border_mode and cval check scipy.ndimage.gaussian_filter.

Parameters:
  • sigma (float, Tuple(float), List[Tuple(float) | float] , optional) – Determines strength of the blurring. List must have length equal to the number of channels. Tuple should have same number elements as number of axes - 1. Defaults to 0.8.

  • border_mode (str, optional) – The mode parameter determines how the input array is extended beyond its boundaries. Defaults to “reflect”.

  • cval (float, optional) – Value to fill past edges of image if mode is ‘constant’. Defaults to 0.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image

Image types:

float32

apply(img, **params)[source]
class volumentations_biomedicine.augmentations.transforms.GaussianNoise(var_limit: tuple = (0.001, 0.1), mean: float = 0, always_apply: bool = False, p: float = 0.5)[source]

Bases: ImageOnlyTransform

Adds gaussian noise to the image.

Noise is drawn from the normal distribution.

Parameters:
  • var_limit (tuple, optional) – variance of normal distribution is randomly chosen from this interval. Defaults to (0.001, 0.1).

  • mean (float, optional) – mean of normal distribution. Defaults to 0.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image

Image types:

float32

apply(img, gauss=None)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.GridDropout(ratio: float = 0.5, unit_size_min: int = None, unit_size_max: int = None, holes_number_x: int = None, holes_number_y: int = None, holes_number_z: int = None, shift_x: int = 0, shift_y: int = 0, shift_z: int = 0, random_offset: bool = False, fill_value: int = 0, mask_fill_value: int = None, always_apply: bool = False, p: float = 0.5)[source]

Bases: DualTransform

apply(image, holes=(), **params)[source]
apply_to_mask(image, holes=(), **params)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

get_transform_init_args_names()[source]
class volumentations_biomedicine.augmentations.transforms.HistogramEqualization(bins: int = 256, always_apply: bool = False, p: float = 1)[source]

Bases: ImageOnlyTransform

Performs equalization of histogram.

This equalization is done channel-wise, meaning that each channel is equalized separately. Images are normalized over both spatial and temporal domains together. The output is in the range [0,1].

This transformation is performed with https://scikit-image.org/docs/stable/api/skimage.exposure.html#skimage.exposure.equalize_hist

Parameters:
  • bins (int, optional) – Number of bins for image histogram. Defaults to 256.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image

Image types:

float32

apply(img, **params)[source]
class volumentations_biomedicine.augmentations.transforms.Normalize(mean: Union[float, List[float]] = 0, std: Union[float, List[float]] = 1, always_apply: bool = True, p: float = 1.0)[source]

Bases: ImageOnlyTransform

Normalize image channels to the given mean and std.

Normalization is performed channel-wise.

Parameters:
  • mean (float | List[float], optional) – Value of desired mean. If it is list, then it should have same length as number of channels, and each value corresponds to the desired mean in respective channel. Defaults to 0.

  • std (float | List[float], optional) – Value of desired std. If it is list, then it should have same length as number of channels, and each value corresponds to the desired std in respective channel. Defaults to 1.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image

Image types:

float32

apply(img)[source]
class volumentations_biomedicine.augmentations.transforms.NormalizeMeanStd(mean: Union[List[float], float], std: Union[List[float], float], always_apply: bool = True, p: float = 1.0)[source]

Bases: ImageOnlyTransform

Normalization of image by given mean and std.

For a single channel image normalization is applied by the formula \(img = (img - mean) / std\).

If image contains more channels, then for each channel previous formula is used.

Parameters:
  • mean (float | List[float]) – Mean of image. If there are more channels, then it should be list of means for each channel.

  • std (float | List[float]) – Std of image. If there are more channels, then it should be list of stds for each channel.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image

Image types:

float32

apply(image, **params)[source]
class volumentations_biomedicine.augmentations.transforms.Pad(pad_size: Union[int, Tuple[int], List[Union[Tuple[int], int]]], border_mode: str = 'constant', ival: Union[float, Sequence] = 0, mval: Union[float, Sequence] = 0, ignore_index: Optional[float] = None, always_apply: bool = False, p: float = 1)[source]

Bases: DualTransform

Pads the input.

Input is padded based on pad_size. If pad_size is only one number, all spatial axes are padded on both sides with this number. If it is tuple, then it has same behaviour as pad_size except sides are padded with different number of pixels. If it is List, then it must have 3 items, which define padding for each spatial dimension separately (in either of the ways described above). If the List is shorter, remaining axes are padded with 0.

For other parameters check https://numpy.org/doc/stable/reference/generated/numpy.pad.html

Parameters:
  • pad_size (int | Tuple[int] | List[int | Tuple[int]]) – Determines number of pixels to be padded. Tuple should be of size 2. List should be of size equal to the image axes - 1 (channel axis).

  • border_mode (str, optional) – numpy.pad parameter . Defaults to ‘constant’.

  • value (float | Sequence, optional) – value for image if needed by chosen border_mode. Defaults to 0.

  • mask_value (float | Sequence, optional) – value for mask if needed by chosen border_mode. Defaults to 0.

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image, mask

Image types:

float32

apply(img)[source]
apply_to_mask(mask)[source]
class volumentations_biomedicine.augmentations.transforms.RandomBrightnessContrast(brightness_limit=0.2, contrast_limit=0.2, always_apply=False, p=0.5)[source]

Bases: ImageOnlyTransform

Randomly change brightness and contrast of the input image.

Unlike RandomBrightnessContrast from Albumentations, this transform is using formula \(f(a) = (c+1) * a + b\), where c is contrast and b is brightness.

Parameters:
  • brightness_limit ((float, float) | float, optional) – Interval from which change in brightness is taken. If limit is a single float, the interval will be (-limit, limit). If change in brightness is 0, brightness won`t change. Defaults to 0.2.

  • contrast_limit ((float, float) | float, optional) – Interval from which change in contrast is taken. If limit is a single float, the interval will be (-limit, limit). If change in contrast is 0, contrast won`t change. Defaults to 0.2.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image

Image types:

float32

apply(img, alpha=1.0, beta=0.0, **params)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

get_transform_init_args_names()[source]
class volumentations_biomedicine.augmentations.transforms.RandomCrop(shape: tuple, border_mode: str = 'reflect', ival: Union[Sequence[float], float] = (0, 0), mval: Union[Sequence[float], float] = (0, 0), ignore_index: Optional[float] = None, always_apply: bool = False, p: float = 1.0)[source]

Bases: DualTransform

Randomly crops region from input. Size of this crop is given by shape.

Unlike RandomCrop from Albumentations, this transform pads the input in dimensions where the input is smaller than the crop-shape with numpy.pad, for which are border_mode, ival and mval.

Parameters:
  • shape (Tuple[int]) Final shape of input, expected without first axis of image (representing channels) –

  • border_mode (str, optional) – border mode used for numpy.pad. Defaults to “reflect”.

  • ival (Tuple[float], optional) – values used for ‘constant’ or ‘linear_ramp’ for image. Defaults to (0, 0).

  • mval (Tuple[float], optional) – values used for ‘constant’ or ‘linear_ramp’ for mask. Defaults to (0, 0).

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image, mask

Image types:

float32

apply(img, crop_start=array([0, 0, 0]))[source]
apply_to_mask(mask, crop_start=array([0, 0, 0]))[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.RandomDropPlane(plane_drop_prob=0.1, axes=(0,), always_apply=False, p=1.0)[source]

Bases: DualTransform

Randomly drop some planes in axis randomly chosen from ‘axes’ input array.

Parameters:
  • plane_drop_prob (float) – float value in (0.0, 1.0) range. Default: 0.1

  • axes (tuple) – 0

  • p (float) – probability of applying the transform. Default: 1.

Targets:

image, mask

Image types:

uint8, float32

apply(img, indexes=(), axis=0, **params)[source]
apply_to_mask(mask, indexes=(), axis=0, **params)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.RandomFlip(axes_to_choose: Union[None, List[Tuple[int]]] = None, always_apply=False, p=0.5)[source]

Bases: DualTransform

Flips a input around a tuple of axes randomly chosen from the input list of axis combinations.

If axes_to_choose to choose is None, random subset of spatial axes is chosen.

Parameters:
  • axes_to_choose (List[Tuple[int]] or None, optional) – Randomly chooses tuple of axes from list around which to flip input. If None then a random subset of spatial axes is chosen. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image, mask

Image types:

float32

apply(img, axes)[source]
apply_to_mask(mask, axes)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.RandomGamma(gamma_limit: Tuple[float] = (0.8, 1.2), always_apply: bool = False, p: float = 0.5)[source]

Bases: ImageOnlyTransform

Performs gamma transform with a randomly selected gamma.

Gamma is randomly selected from interval given by gamma_limit. If the values in image are not in [0,1] interval then this transformation is skipped.

Parameters:
  • gamma_limit (Tuple(float), optional) – Interval from which gamma is selected. Defaults to (0.8, 1.20).

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image

Image types:

float32

apply(img, gamma=1, **params)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

get_transform_init_args_names()[source]
class volumentations_biomedicine.augmentations.transforms.RandomGaussianBlur(max_sigma: Union[float, Tuple[float], List[Union[Tuple[float], float]]] = 0.8, start_of_interval: float = 0, border_mode: str = 'reflect', cval: float = 0, always_apply: bool = False, p: float = 0.5)[source]

Bases: ImageOnlyTransform

Performs gaussian blur on the image with a random strength blurring.

Behaves similarly to GaussianBlur, sigma has same format, but each number in sigma creates interval [start_of_interval, sigma_number], from which random number is chosen.

Parameters:
  • sigma (float, Tuple(float), List[Tuple(float) | float, optional) – Determines end of interval from which strength of blurring is chosen. Defaults to 0.8.

  • start_of_interval (float, optional) – Determines start of interval from which strength of blurring is chosen. Defaults to 0.

  • border_mode (str, optional) – The mode parameter determines how the input array is extended beyond its boundaries. Defaults to “reflect”.

  • cval (float, optional) – Value to fill past edges of image if mode is ‘constant’. Defaults to 0.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image

Image types:

float32

apply(img, sigma, **params)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.RandomRotate90(axes: List[int] = [1, 2, 3], shuffle_axis: bool = False, always_apply: bool = False, p: float = 0.5)[source]

Bases: DualTransform

Rotation of input by 0/90/180/270 degrees in spatial dimensions.

Input is being rotated around the specified axes. For example if axes = [3,2], then input is rotated around 3 axis (1 and 2 axes are changing) and afterwards it is rotated around 2 axis(1 and 3 axes are changing).

Parameters:
  • axes (List[int], optional) – list of axes around which input is rotated and also determines order if shuffle_axis is false. Ignoring axes which are not in this list [1,2,3]. Number in axes do not need to be unique. Defaults to [1, 2, 3].

  • shuffle_axis (bool, optional) – If set to True, order of rotations is random. Defaults to False.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image, mask

Image types:

float32

apply(img, rotation_around, factor)[source]
apply_to_mask(mask, rotation_around, factor)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.RandomScale(scale_limit: Union[float, Tuple[float], List[Tuple[float]]] = (0.9, 1.1), interpolation: int = 1, border_mode: str = 'reflect', ival: float = 0, mval: float = 0, ignore_index: Optional[float] = None, always_apply: bool = False, p: float = 0.5)[source]

Bases: DualTransform

Randomly rescale input by the given scale.

Under the hood, https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html is being used.

Parameters:
  • scale_limit (float | Tuple[float] | List[Tuple[float]], optional) – Value by which the input should be scaled. If there is single value, then all spatial dimensions are scaled by it. If input is tuple, it creates interval from which the single value for scaling will be chosen. If input is list it should have length of number axes of input - 1 (- channel dimension) and contains tuple of 2 elements. All dimensions except for channel one are scaled by the number from the interval given by tuple. If there is one less dimensions then last dimension(time) is not scaled. Defaults to (0.9, 1.1).

  • interpolation (int, optional) – order of spline interpolation for image. Defaults to 1.

  • border_mode (str, optional) – points outside image are filled according to the this mode.. Defaults to ‘reflect’.

  • ival (float, optional) – value outside of image when the border_mode is chosen to be “constant”. Defaults to 0.

  • mval (float, optional) – value outside of mask when the border_mode is chosen to be “constant”. Defaults to 0.

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 0.5.

Targets:

image, mask

Image types:

float32

apply(img, scale)[source]
apply_to_mask(mask, scale)[source]
get_params(**data)[source]

shared parameters for one apply. (usually random values)

class volumentations_biomedicine.augmentations.transforms.Resize(shape: tuple, interpolation: int = 1, border_mode: str = 'reflect', ival: float = 0, mval: float = 0, anti_aliasing_downsample: bool = True, ignore_index: Optional[float] = None, always_apply: bool = False, p: float = 1)[source]

Bases: DualTransform

Resize input to the given shape.

Resize input using skimage resize function. Shape is expected without channel dimensions. If there is one less dimension, than expected then size of last dimension(time) is unchanged. Interpolation, border_mode, ival, mval and anti_aliasing_downsample are arguments for https://scikit-image.org/docs/stable/api/skimage.transform.html#skimage.transform.resize

Parameters:
  • shape (tuple of ints) – shape of desired image without channel dimension. If inputed with one less dimensions, it is expected that it is time dimensions and is copied from image.

  • interpolation (int, optional) – order of spline interpolation for image. Defaults to 1.

  • border_mode (string, optional) – points outside image are filled according to the this mode. Defaults to ‘reflect’.

  • ival (float, optional) – value outside of image when the border_mode is chosen to be “constant”. Defaults to 0.

  • mval (float, optional) – value outside of mask when the border_mode is chosen to be “constant”. Defaults to 0.

  • anti_aliasing_downsample (bool, optional) – controls if the gaussian filter should be used on image before downsampling, recommended. Defaults to True.

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image, mask

Image types:

float32

apply(img)[source]
apply_to_mask(mask)[source]
class volumentations_biomedicine.augmentations.transforms.Scale(scale_factor: Union[float, List[float]] = 1, interpolation: int = 1, border_mode: str = 'reflect', ival: float = 0, mval: float = 0, ignore_index: Optional[float] = None, always_apply: bool = False, p: int = 1)[source]

Bases: DualTransform

Rescale input by the given scale.

Rescaling is done by function zoom from scipy. If scale_factor is float, spatial dimensions are scaled by this number. If it is list, then it is expected without channel dimensions. If there is one less dimension, than expected then size of last dimensions(time) is unchanged. Check https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html for additional arguments.

Parameters:
  • scale_factor (float|List[float], optional) – Value by which the input should be scaled. If there is single value, then all spatial dimensions are scaled by it. If input is list then all dimensions except for channel one are scaled by it. If there is one less dimensions then last dimension(time) is not scaled. Defaults to 1.

  • interpolation (int, optional) – order of spline interpolation for image.. Defaults to 1.

  • border_mode (str, optional) – points outside image are filled according to the this mode. Defaults to ‘reflect’.

  • ival (float, optional) – value outside of image when the border_mode is chosen to be “constant”. Defaults to 0.

  • mval (float, optional) – value outside of mask when the border_mode is chosen to be “constant”. Defaults to 0.

  • ignore_index (float | None, optional) – If ignore_index is float, then transformation of mask is done with border_mode = “constant” and mval = ignore_index. If ignore_index is None, then it does nothing. Defaults to None.

  • always_apply (bool, optional) – always apply transformation in composition. Defaults to False.

  • p (float, optional) – chance of applying transformation in composition. Defaults to 1.

Targets:

image, mask

Image types:

float32

apply(img)[source]
apply_to_mask(mask)[source]