Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

nidl.transforms.volume.augmentation.RandomHistogramShift

class nidl.transforms.volume.augmentation.RandomHistogramShift(num_control_points=10, **kwargs)[source]

Bases: VolumeTransform

Remap the intensities of a 3d volume with a random increasing curve.

The curve interpolates control points evenly spaced on the intensity range, with the inner ones moved at random (fewer points, larger shifts). Reimplementation of MONAI’s RandHistogramShift [1] (Apache-2.0).

Parameters:
num_control_points: int, default=10

Number of control points (at least 3).

kwargs: dict

Keyword arguments.

References

[1]

Cardoso, M. J., et al., “MONAI: An open-source framework for deep learning in healthcare.” arXiv, 2022. https://arxiv.org/abs/2211.02701

__init__(num_control_points=10, **kwargs)[source]
apply_transform(data)[source]

Remap the intensities (a constant volume is unchanged).

Parameters:
data: np.ndarray or torch.Tensor

The input volume.

Returns:
data: np.ndarray or torch.Tensor

Remapped volume, same type and shape as the input.