deepmr.prox.wavelet_denoise#
- deepmr.prox.wavelet_denoise(input, ndim, ths, wv='db4', device=None, non_linearity='soft', level=None)[source]#
Apply orthogonal Wavelet denoising with the \(\ell_1\) norm.
Adapted from :func:
deepinv.denoisers.WaveletDenoiser
to support complex-valued inputs.This denoiser is defined as the solution to the optimization problem:
\[\underset{x}{\arg\min} \; \|x-y\|^2 + \gamma \|\Psi x\|_n\]where \(\Psi\) is an orthonormal wavelet transform, \(\lambda>0\) is a hyperparameter, and where \(\|\cdot\|_n\) is either the \(\ell_1\) norm (
non_linearity="soft"
) or the \(\ell_0\) norm (non_linearity="hard"
). A variant of the \(\ell_0\) norm is also available (non_linearity="topk"
), where the thresholding is done by keeping the \(k\) largest coefficients in each wavelet subband and setting the others to zero.The solution is available in closed-form, thus the denoiser is cheap to compute.
- Parameters:
input (np.ndarray | torch.Tensor) – Input image of shape (…, n_ndim, …, n_0).
ndim (int) – Number of spatial dimensions, can be either
2
or3
.ths (float) – Denoise threshold.
wv (str, optional) – Wavelet name to choose among those available in pywt. The default is
"db4"
.device (str, optional) – Device on which the wavelet transform is computed. The default is
None
(infer from input).non_linearity (str, optional) –
"soft"
,"hard"
or"topk"
thresholding. The default is"soft"
.level (int, optional) – Level of the wavelet transform. The default is
None
.
- Returns:
output – Denoised image of shape (…, n_ndim, …, n_0).
- Return type:
np.ndarray | torch.Tensor