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.volume.transforms.augmentation.RandomGaussianBlur

class nidl.volume.transforms.augmentation.RandomGaussianBlur(sigma=(0, 2), **kwargs)[source]

Bases: VolumeTransform

Blur a 3d volume using a Gaussian filter with random kernel size.

It handles a numpy.ndarray or torch.Tensor as input and returns a consistent output (same type and shape). Input shape must be (C, H, W, D) or (H, W, D) (spatial dimensions).

Parameters:
sigma: (float, float) or (float, float, float, float, float, float), default=(0, 2)

Range of the standard deviation \sigma of the Gaussian kernel applied to blur the volume. If two values (a,b) are provided, then \sigma \sim \mathcal{U}(a, b). If six values (a_1, b_1, a_2, b_2, a_3, b_3) are provided, then one standard deviation per spatial dimension is sampled \sigma_i \sim \mathcal{U}(a_i, b_i) for i=1,2,3.

kwargs: dict

Keyword arguments.

__init__(sigma=(0, 2), **kwargs)[source]
apply_transform(data)[source]

Blur the input with a Gaussian filter.

Parameters:
data: np.ndarray or torch.Tensor

Input volume with shape (C, H, W, D) or (H, W, D). Standard deviations in the Gaussian filter are equal across channels.

Returns:
data: np.ndarray or torch.Tensor

Blurred volume. Output type and shape are the same as input.