mrpro.algorithms.denoiser.patch_based_denoising
- mrpro.algorithms.denoiser.patch_based_denoising(idata: IData, dictionary_op: LinearOperator, patch_dim: Sequence[int], patch_size: Sequence[int], stride: Sequence[int] | None = None, regularization_weight: float = 1.0, max_iterations: int = 100, backtrack_factor: float = 1.0, convergent_iterates_variant: bool = False) IData
- mrpro.algorithms.denoiser.patch_based_denoising(idata: Tensor, dictionary_op: LinearOperator, patch_dim: Sequence[int], patch_size: Sequence[int], stride: Sequence[int] | None = None, regularization_weight: float = 1.0, max_iterations: int = 100, backtrack_factor: float = 1.0, convergent_iterates_variant: bool = False) Tensor
Apply patch-based dictionary denoising.
The noisy image \(x_\mathrm{noisy}\) is split into (possibly overlapping) patches, defined by the patch size and strides. Each patch is then approximated by a sparse linear combination of elements of a pre-defined synthesis dictionary \(\Psi\):, solving an \(\ell_1\):-regularized problem with the accelerated proximal gradient descent.
More precisely, the algorithm performs the following steps: .. math:
\mu_j &:= \mathrm{Mean}(R_j x_\mathrm{noisy}) \\ z_j &:= R_j x_\mathrm{noisy} - \mu_j \\ \gamma_j^* &:= \arg\min_{\gamma_j} \frac{1}{2} \| \Psi \gamma_j - z_j \|_2^2 + \lambda \| \gamma_j \|_1 \\ x_\mathrm{Rec} &:= \frac{1}{d} \sum_j R_j^T \left( \Psi \gamma_j^* + \mu_j \right)
where \(R_j\) extracts the \(j\)-th patch from the image and the adjoint \(R_j^T\) puts it back in its position in the image. \(\mu_j\) is the mean of the \(j\)-th patch and \(z_j\) is the corresponding patch with mean zero. \(\lambda > 0\) is the regularization weight for the sparse coefficients, and \(d\) counts for the overlap of the patches. The minimization problem for sparse coefficients \(\gamma_j^*\) is solved with the Proximal Gradient Descent (PGD) algorithm.
Note: The noisy image idata determines on which device the algorithm will be run. This means that, for example, if idata is on the cpu and dictionary_op on the gpu, dictionary_op will be transferred (in-place) to the cpu. The denoised image will also be on the device specified by idata.
- Parameters:
dictionary_op (
LinearOperator) – Linear Operator representing the dictionary (\(\Psi\)), mapping the sparse coefficients to the patches.patch_dim (
Sequence[int]) – Dimension(s) to extract patches from.stride (
Sequence[int] |None, default:None) – Stride for extracting the patches.regularization_weight (
float, default:1.0) – Strength of the regularization (\(\lambda\)).max_iterations (
int, default:100) – Maximum number of PGD iterations.backtrack_factor (
float, default:1.0) – Factor for backtracking line search. If 1.0, no backtracking is performed.convergent_iterates_variant (
bool, default:False) – IfTrue, use the convergent iterates variant of PGD.
- Returns:
the denoised image.