Skip to content

Mean Std Normalization

Source

Zero-mean and unit-variance normalization.

MeanStdNormalization

Bases: Normalization

Zero-mean and unit-variance normalization.

The normalization expects arrays of dimensions C(Z)YX.

Parameters:

  • input_means (list[float]) –

    Mean values (length 1 for global, multiple values for per channel).

  • input_stds (list[float]) –

    Standard deviation values (length 1 for global, multiple values for per channel).

  • target_means (list[float] | None, default: None ) –

    Target mean values (length 1 for global, multiple values for per channel), by default None.

  • target_stds (list[float] | None, default: None ) –

    Target standard deviation values (length 1 for global, multiple values for per channel), by default None.

__call__(patch, target=None)

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

Parameters:

  • patch (ndarray) –

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

  • target (ndarray, default: None ) –

    Target for the patch, by default None.

Returns:

  • tuple of numpy.ndarray

    Transformed patch and target, the target can be returned as None.

__init__(input_means, input_stds, target_means=None, target_stds=None)

Constructor.

Parameters:

  • input_means (list[float]) –

    Mean values (length 1 for global, multiple values for per channel).

  • input_stds (list[float]) –

    Standard deviation values (length 1 for global, multiple values for per channel).

  • target_means (list[float] | None, default: None ) –

    Target mean values (length 1 for global, multiple values for per channel), by default None.

  • target_stds (list[float] | None, default: None ) –

    Target standard deviation values (length 1 for global, multiple values for per channel), by default None.

denormalize(patch)

Reverse the normalization operation for a batch of patches.

Parameters:

  • patch (Tensor) –

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

Returns:

  • Tensor

    Transformed array.