gaussian_blur#

deepinv.physics.functional.gaussian_blur(psf_size=None, sigma=(1.0, 1.0), angle=0.0, device='cpu', dtype=torch.float32)[source]#

Creates a batch of N-dimensional anisotropic Gaussian kernels (1D, 2D, or 3D) with independent sigma ranges and rotation angles for each kernel.

The dimension (1D, 2D, or 3D) of the kernel is determined by the length of the psf_size tuple, if None, it is determined by the length of the sigma tuple. If both are provided, their dimensions must match. Batch size is determined by the shape of sigma or angle, if both are provided, their shapes must be compatible. If both are scalars (int, float or a tuple), the batch size is 1 and the same kernel is repeated for the entire batch. If sigma is a tensor of shape (batch_size, dim), then each kernel in the batch can have different sigma values.

Parameters:
  • psf_size (tuple[int, ...]) – Shape of the point spread function for the batch, it can be a tuple specifying the size for each dimension (e.g., (7, 3) for 2D), or None to automatically determine the size based on sigma.

  • sigma (int | float | tuple[float, ...] | torch.Tensor) – If a float or integer is provided, the kernel is isotropic with the specified sigma for all dimensions. The user can define an anisotropic kernel by passing a tuple of float. If a float, integer, or tuple is provided, the same kernel is repeated for the entire batch. If a tensor of shape (batch_size, dim) is provided, each kernel in the batch can have different sigma values.

  • angle (int | float | tuple[float, ...] | torch.Tensor) – Rotation angle(s) for each kernel in the batch (degrees). For 2D kernels, this is a single angle of rotation in the plane. For 3D kernels, this can be a tuple of three angles (gamma, beta, alpha) representing rotations around the x, y, and z axes respectively. In 3D, if a single angle is provided, it is applied as a rotation around the z-axis. If a tuple of three angles is provided, they are applied as rotations around the x, y, and z axes in that order. If a tensor of shape (batch_size,) for 2D or (batch_size, 3) for 3D is provided, each kernel in the batch can have its own rotation angle(s).

  • device (str) – Device to create the tensor on.

Returns:

A tensor of batched N-dimensional Gaussian kernels of shape (batch_size, *psf_size).

Return type:

Tensor

Examples using gaussian_blur:#

Use a pretrained model

Use a pretrained model

5 minute quickstart tutorial

5 minute quickstart tutorial

Image deblurring with custom deep explicit prior.

Image deblurring with custom deep explicit prior.

Poisson Inverse Problems with Maximum-Likelihood Expectation-Maximization (MLEM)

Poisson Inverse Problems with Maximum-Likelihood Expectation-Maximization (MLEM)

Tour of blur operators

Tour of blur operators

Tour of forward sensing operators

Tour of forward sensing operators

Spatial unwrapping and modulo imaging

Spatial unwrapping and modulo imaging

Plug-and-Play algorithm with Mirror Descent for Poisson noise inverse problems.

Plug-and-Play algorithm with Mirror Descent for Poisson noise inverse problems.

Reducing the memory and computational complexity of unfolded network training

Reducing the memory and computational complexity of unfolded network training