deepmr.fft.fft

Contents

deepmr.fft.fft#

deepmr.fft.fft(input, axes=None, norm='ortho', centered=True)[source]#

Centered Fast Fourier Transform.

Adapted from [1].

Parameters:
  • input (np.ndarray | torch.Tensor) – Input signal.

  • axes (Iterable[int], optional) – Axes over which to compute the FFT. If not specified, apply FFT over all the axes.

  • norm (str, optional) – FFT normalization. The default is ortho.

  • centered (bool, optional) – FFT centering. The default is True.

Returns:

output – Output signal.

Return type:

np.ndarray | torch.Tensor

Examples

>>> import torch
>>> import deepmr

First, create test image:

>>> image = torch.zeros(32, 32, dtype=torch.complex64)
>>> image = image[16, 16] = 1.0

We now perform a 2D FFT:

>>> kspace = deepmr.fft.fft(image)

We can visualize the data:

>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots(1, 2)
>>> im = ax[0].imshow(abs(image))
>>> ax[0].set_title("Image", color="orangered", fontweight="bold")
>>> ax[0].axis("off")
>>> ax[0].set_alpha(0.0)
>>> fig.colorbar(im, ax=ax[0], shrink=0.5)
>>> ksp = ax[1].imshow(abs(kspace))
>>> ax[1].set_title("k-Space", color="orangered", fontweight="bold")
>>> ax[1].axis("off")
>>> ax[1].set_alpha(0.0)
>>> fig.colorbar(ksp, ax=ax[1], shrink=0.5)
>>> plt.show()

References

[1] mikgroup/sigpy