mr2.algorithms.denoising.synthesis_denoising

mr2.algorithms.denoising.synthesis_denoising(idata: Image, synthesis_operator: LinearOperator, regularization_weight: float | Tensor, *, initial_codes: Tensor | None = None, max_iterations: int = 100, tolerance: float = 0, low_pass_operator: LinearOperator | None = None, max_iterations_low_pass: int = 32, tolerance_low_pass: float = 1e-6) → Image[source]

Denoise by synthesis sparse coding with backtracked accelerated PGD.

Without a low-pass operator, solves \(c^* = \arg\min_c \frac12\|Dc-y\|_2^2 + \sum_i w_i |c_i|\) and returns \(Dc^*\). Complex coefficients use magnitude sparsity. For convolutional denoising, use a ConvolutionOp mapping coefficient channels to one output channel, followed by RearrangeOp('1 ... -> ...') to remove that channel. Alternatively, use the Hermitian adjoint of an image-to-coefficients operator. That paired model can differ from forward convolution in kernel and boundary conventions.

With a low-pass operator \(B\), first computes the baseline \(b = \arg\min_b \frac12\|b-y\|_2^2 + \frac12\|Bb\|_2^2\) using CG on \((I+B^HB)b=y\). It then codes the residual \(y-b\) using the above sparsity objective and returns \(b+Dc^*\). For example, use low_pass_operator=beta**0.5 * FiniteDifferenceOp(dim=(-2, -1)). This is an explicit two-stage model, generally different from analysis denoising.

Operators are used as supplied and must support the image’s device and dtype. No operators or images are copied or converted; dtype promotion follows the underlying operations. PGD starts at 0.9 divided by the estimated squared dictionary norm, with backtracking as a safeguard. A zero norm uses a unit step.

Parameters:
  • idata (TypeVar(Image, Tensor, IData)) – Noisy tensor or IData. Output retains its shape and header.

  • synthesis_operator (LinearOperator) – Linear map from coefficients to images, with a true Hermitian adjoint. The adjoint applied to the image determines the coefficient shape and dtype.

  • regularization_weight (float | Tensor) – Nonnegative finite scalar or map broadcasting to, without expanding, the coefficient shape.

  • initial_codes (Tensor | None, default: None) – Initial coefficients of exactly the expected shape. Defaults to zeros with the adjoint output’s dtype and device.

  • max_iterations (int, default: 100) – Maximum number of accelerated PGD iterations (positive).

  • tolerance (float, default: 0) – Nonnegative relative coefficient-change tolerance. Zero disables early stopping.

  • low_pass_operator (LinearOperator | None, default: None) – Optional image-to-penalty map defining the baseline, including its strength and boundaries.

  • max_iterations_low_pass (int, default: 32) – Maximum CG iterations for the optional baseline (positive).

  • tolerance_low_pass (float, default: 1e-6) – Positive absolute residual-norm tolerance for CG; choose it according to the image scale.

Returns:

Denoised image of the same container type as the input.