trw.transforms.transforms_normalize_intensity

Module Contents

Classes

TransformNormalizeIntensity

Normalize a tensor image with mean and standard deviation.

Functions

_transform_normalize(features_names, batch, mean, std)

trw.transforms.transforms_normalize_intensity._transform_normalize(features_names, batch, mean, std)
class trw.transforms.transforms_normalize_intensity.TransformNormalizeIntensity(mean: Sequence[numbers.Number], std: Sequence[numbers.Number], criteria_fn: Optional[trw.transforms.transforms.CriteriaFn] = None)

Bases: trw.transforms.transforms.TransformBatchWithCriteria

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the torch array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

  • criteria_fn – function applied on each feature. If satisfied, the feature will be transformed, if not the original feature is returned

Returns

A normalized batch such that the mean is 0 and std is 1 for the selected features