deepmr.fwt#
- deepmr.fwt(input, ndim=None, device=None, wave_name='db4', level=None)[source]#
 Forward wavelet transform.
Adapted from Sigpy [1].
- Parameters:
 input (np.ndarray | torch.Tensor) – Input signal of shape (…, nz, ny, nx).
ndim (int, optional) – Number of spatial dimensions over to which compute wavelet transform (
1,2,3). Assume spatial axis are the rightmost ones. The default isNone(ndim = min(3, len(input.shape))).device (str, optional) – Computational device for Wavelet transform. If not specified, use
input.device. The default isNone.wave_name (str, optional) – Wavelet name. The default is
"db4".axes (Iterable[int], optional) – Axes to perform wavelet transform. The default is
None(all axes).level (int, optional) – Number of wavelet levels. The default is
None.
- Returns:
 output (np.ndarray | torch.Tensor) – Output wavelet decomposition.
shape (Iterable[int]) – Input signal shape (
input.shape) for synthesis.
Examples
>>> import torch >>> import deepmr
First, generate a 2D phantom and add some noise:
>>> img = deepmr.shepp_logan(128) + 0.05 * torch.randn(128, 128)
Now, run wavelet decomposition:
>>> coeff, shape = deepmr.fwt(img)
The function returns a
coefftuple, containing the Wavelet coefficients, and ashapetuple, containing the original image shape for image synthesis viadeepmr.iwt:>>> shape torch.Size([128, 128])
References
[1] mikgroup/sigpy