Skip to content

XY Random Rotate90

Source

Patch transform applying XY random 90 degrees rotations.

XYRandomRotate90

Bases: Transform

Applies random 90 degree rotations to the YX axis.

This transform expects C(Z)YX dimensions.

Attributes:

  • rng (Generator) –

    Random number generator.

  • p (float) –

    Probability of applying the transform.

  • seed (Optional[int]) –

    Random seed.

Parameters:

  • p (float, default: 0.5 ) –

    Probability of applying the transform, by default 0.5.

  • seed (Optional[int], default: None ) –

    Random seed, by default None.

__call__(patch, target=None, **additional_arrays)

Apply the transform to the source patch and the target (optional).

Parameters:

  • patch (ndarray) –

    Patch, 2D or 3D, shape C(Z)YX.

  • target (Optional[ndarray], default: None ) –

    Target for the patch, by default None.

  • **additional_arrays (NDArray, default: {} ) –

    Additional arrays that will be transformed identically to patch and target.

Returns:

  • tuple[ndarray, Optional[ndarray]]

    Transformed patch and target.

__init__(p=0.5, seed=None)

Constructor.

Parameters:

  • p (float, default: 0.5 ) –

    Probability of applying the transform, by default 0.5.

  • seed (Optional[int], default: None ) –

    Random seed, by default None.