Skip to content

Range Normalization

Source

Range (min-max) normalization for image patches.

RangeNormalization

Bases: Normalization

Normalize an image or image patch to [0, 1] range.

This transform expects C(Z)YX dimensions for normalization and BC(Z)YX for denormalization. Returns float32 arrays.

Parameters:

  • input_mins (list of float) –

    Minimum value per channel.

  • input_maxes (list of float) –

    Maximum value per channel.

  • target_mins (list of float, default: None ) –

    Target minimum value per channel.

  • target_maxes (list of float, default: None ) –

    Target maximum value per channel.

Attributes:

  • input_mins (list of float) –

    Minimum value per channel.

  • input_maxes (list of float) –

    Maximum value per channel.

  • target_mins (list of float, optional) –

    Target minimum value per channel.

  • target_maxes (list of float, optional) –

    Target maximum value per channel.

__call__(patch, target=None)

Apply range normalization to patch and optional target.

Parameters:

  • patch (NDArray) –

    Patch with shape C(Z)YX.

  • target (NDArray, default: None ) –

    Target patch with shape C(Z)YX.

Returns:

  • tuple of NDArray

    Normalized patch and target (target can be None).

__init__(input_mins, input_maxes, target_mins=None, target_maxes=None)

Initialize range normalization.

Parameters:

  • input_mins (list of float) –

    Minimum value per channel.

  • input_maxes (list of float) –

    Maximum value per channel.

  • target_mins (list of float or None, default: None ) –

    Target minimum per channel.

  • target_maxes (list of float or None, default: None ) –

    Target maximum per channel.

denormalize(patch)

Reverse the normalization operation for a batch of patches.

Parameters:

  • patch (Tensor) –

    Normalized patch with shape BC(Z)YX.

Returns:

  • Tensor

    Denormalized patch.