mr2.algorithms.denoising.wavelet_denoising
- mr2.algorithms.denoising.wavelet_denoising(idata: IData, regularization_dim: tuple[int] | tuple[int, int] | tuple[int, int, int], regularization_weight: float | Tensor, *, wavelet_name: Literal['haar', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9', 'db10', 'db11', 'db12', 'db13', 'db14', 'db15', 'db16', 'db17', 'db18', 'db19', 'db20', 'db21', 'db22', 'db23', 'db24', 'db25', 'db26', 'db27', 'db28', 'db29', 'db30', 'db31', 'db32', 'db33', 'db34', 'db35', 'db36', 'db37', 'db38', 'sym2', 'sym3', 'sym4', 'sym5', 'sym6', 'sym7', 'sym8', 'sym9', 'sym10', 'sym11', 'sym12', 'sym13', 'sym14', 'sym15', 'sym16', 'sym17', 'sym18', 'sym19', 'sym20', 'coif1', 'coif2', 'coif3', 'coif4', 'coif5', 'coif6', 'coif7', 'coif8', 'coif9', 'coif10', 'coif11', 'coif12', 'coif13', 'coif14', 'coif15', 'coif16', 'coif17', 'bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8', 'rbio1.1', 'rbio1.3', 'rbio1.5', 'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8', 'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7', 'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8', 'dmey'] = 'db4', level: int | None = None) IData[source]
- mr2.algorithms.denoising.wavelet_denoising(idata: Tensor, regularization_dim: tuple[int] | tuple[int, int] | tuple[int, int, int], regularization_weight: float | Tensor, *, wavelet_name: Literal['haar', 'db1', 'db2', 'db3', 'db4', 'db5', 'db6', 'db7', 'db8', 'db9', 'db10', 'db11', 'db12', 'db13', 'db14', 'db15', 'db16', 'db17', 'db18', 'db19', 'db20', 'db21', 'db22', 'db23', 'db24', 'db25', 'db26', 'db27', 'db28', 'db29', 'db30', 'db31', 'db32', 'db33', 'db34', 'db35', 'db36', 'db37', 'db38', 'sym2', 'sym3', 'sym4', 'sym5', 'sym6', 'sym7', 'sym8', 'sym9', 'sym10', 'sym11', 'sym12', 'sym13', 'sym14', 'sym15', 'sym16', 'sym17', 'sym18', 'sym19', 'sym20', 'coif1', 'coif2', 'coif3', 'coif4', 'coif5', 'coif6', 'coif7', 'coif8', 'coif9', 'coif10', 'coif11', 'coif12', 'coif13', 'coif14', 'coif15', 'coif16', 'coif17', 'bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8', 'rbio1.1', 'rbio1.3', 'rbio1.5', 'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8', 'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7', 'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8', 'dmey'] = 'db4', level: int | None = None) Tensor
Soft threshold wavelet coefficients and reconstruct the image.
All coefficients, including the low-frequency approximation band, are thresholded. Complex coefficients are shrunk separately in their real and imaginary parts using
L1NormViewAsReal. This penalizes \(|\mathrm{Re}(c)| + |\mathrm{Im}(c)|\), rather than complex magnitude, and is not phase invariant.This is the exact proximal map of the weighted wavelet L1 penalty only when the transform is orthonormal/unitary (for example, Haar with axis lengths divisible by \(2^{\mathrm{level}}\)).
WaveletOpuses zero padding and usually produces redundant boundary coefficients for longer filters. Thresholding followed by reconstruction is then not generally the proximal map of the analysis penalty.- Parameters:
idata (
IData|Tensor) – Input image with float32, float64, complex64 or complex128 dtype.regularization_dim (
tuple[int] |tuple[int,int] |tuple[int,int,int]) – One, two or three distinct axes along which to transform. Negative axes are supported. Selected axis lengths must be positive and even, as required byWaveletOp.regularization_weight (
float|Tensor) – Finite, nonnegative real coefficient threshold, not a noise standard deviation. A tensor must broadcast to exactly the packed coefficient shape produced byWaveletOp; there is no separate scale axis. The threshold is moved to the image device and converted to its real dtype. It is shared by real and imaginary parts.wavelet_name (
Literal['haar','db1','db2','db3','db4','db5','db6','db7','db8','db9','db10','db11','db12','db13','db14','db15','db16','db17','db18','db19','db20','db21','db22','db23','db24','db25','db26','db27','db28','db29','db30','db31','db32','db33','db34','db35','db36','db37','db38','sym2','sym3','sym4','sym5','sym6','sym7','sym8','sym9','sym10','sym11','sym12','sym13','sym14','sym15','sym16','sym17','sym18','sym19','sym20','coif1','coif2','coif3','coif4','coif5','coif6','coif7','coif8','coif9','coif10','coif11','coif12','coif13','coif14','coif15','coif16','coif17','bior1.1','bior1.3','bior1.5','bior2.2','bior2.4','bior2.6','bior2.8','bior3.1','bior3.3','bior3.5','bior3.7','bior3.9','bior4.4','bior5.5','bior6.8','rbio1.1','rbio1.3','rbio1.5','rbio2.2','rbio2.4','rbio2.6','rbio2.8','rbio3.1','rbio3.3','rbio3.5','rbio3.7','rbio3.9','rbio4.4','rbio5.5','rbio6.8','dmey'], default:'db4') – Orthogonal discrete wavelet supported byWaveletOp, default'db4'. Biorthogonal wavelets are not supported by this convenience function.level (
int|None, default:None) – Nonnegative number of levels. IfNone, use the maximum level without boundary effects according to PyWavelets. A level of zero thresholds the image directly.
- Returns:
Denoised tensor or
IData, matching the input type, dtype and device. Tensor outputs preserve the input shape. For IData input, the header is preserved; repeated data values may be stored as singleton dimensions, as usual for IData.