SpatialUnwrapping#

class deepinv.physics.SpatialUnwrapping(threshold=1.0, mode='round', **kwargs)[source]#

Bases: Physics

Spatial unwrapping forward operator.

This class implements a forward operator for spatial unwrapping, where the input is wrapped modulo a threshold value. The operator can use either floor or round mode for the wrapping operation. It is useful for problems where the observed data is wrapped, such as in phase imaging, modulo imaging, or interferometry.

The forward operator is defined as:

\[y = w_t(x) = x - t \cdot \mathrm{q}(x / t)\]

where \(w_t\) is the modulo operator, \(t\) is the threshold, and \(\mathrm{q}\) is either the rounding or flooring function depending on the mode.

Parameters:
  • threshold (float) – The threshold \(t\) value for the modulo operation (default: 1.0).

  • mode (str) – modulo function \(q(\cdot)\), either ‘round’ or ‘floor’ (default: ‘round’).

  • kwargs – Additional arguments passed to the base Physics class.


Example:
>>> import torch
>>> from deepinv.physics.spatial_unwrapping import SpatialUnwrapping
>>> x = torch.tensor([[0.5, 1.2, 2.7]])
>>> physics = SpatialUnwrapping(threshold=1.0, mode="round")
>>> y = physics(x)
>>> print(torch.round(y, decimals=1))
tensor([[ 0.5000,  0.2000, -0.3000]])
A(x, **kwargs)[source]#

Applies the modulo operator to the input tensor.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

(torch.Tensor) Modulo tensor.

A_adjoint(y, **kwargs)[source]#

Adjoint operator for the modulo operator. For the modulo operator, the adjoint is the identity.

Parameters:

y (torch.Tensor) – Input tensor.

Returns:

(torch.Tensor) Output tensor (identity).

forward(x, **kwargs)[source]#

Applies the forward model for spatial unwrapping.

In spatial unwrapping, the noise model is first applied to the input, followed by the modulo operator.

Parameters:

x (torch.Tensor) – Input tensor.

Returns:

(torch.Tensor) The result after applying noise, modulo operator, and sensor.

Examples using SpatialUnwrapping:#

Spatial unwrapping and modulo imaging

Spatial unwrapping and modulo imaging