Skip to content

Compose

Source

A class chaining transforms together.

Compose

A class chaining transforms together.

Parameters:

  • transform_list (list[SPATIAL_TRANSFORMS_UNION]) –

    A list of dictionaries where each dictionary contains the name of a transform and its parameters.

Attributes:

  • _callable_transforms (Callable) –

    A callable that applies the transforms to the input data.

__call__(patch, target=None)

Apply the transforms to the input data.

Parameters:

  • patch (ndarray) –

    The input data.

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

    Target data, by default None.

Returns:

  • tuple[ndarray, ...]

    The output of the transformations.

__init__(transform_list)

Instantiate a Compose object.

Parameters:

  • transform_list (list[NORM_AND_SPATIAL_UNION]) –

    A list of dictionaries where each dictionary contains the name of a transform and its parameters.

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

Apply the transforms to the input data, including additional arrays.

Parameters:

  • patch (ndarray) –

    The input data.

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

    Target data, by default None.

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

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

Returns:

  • NDArray

    The transformed patch.

  • NDArray | None

    The transformed target.

  • dict of {str, NDArray}

    Transformed additional arrays. Keys correspond to the keyword argument names.