Applies inverse shift and fourier transform. Only the spatial dimensions are transformed. Args: k: K-space data. spatial_dims: Number of spatial dimensions. as_contiguous: Whether to convert the cached NumPy array or PyTorch tensor to be
(k: NdarrayOrTensor, spatial_dims: int, as_contiguous: bool = False)
| 1902 | |
| 1903 | @staticmethod |
| 1904 | def inv_shift_fourier(k: NdarrayOrTensor, spatial_dims: int, as_contiguous: bool = False) -> NdarrayOrTensor: |
| 1905 | """ |
| 1906 | Applies inverse shift and fourier transform. Only the spatial |
| 1907 | dimensions are transformed. |
| 1908 | |
| 1909 | Args: |
| 1910 | k: K-space data. |
| 1911 | spatial_dims: Number of spatial dimensions. |
| 1912 | as_contiguous: Whether to convert the cached NumPy array or PyTorch tensor to be contiguous. |
| 1913 | |
| 1914 | Returns: |
| 1915 | x: Tensor in image space. |
| 1916 | """ |
| 1917 | dims = tuple(range(-spatial_dims, 0)) |
| 1918 | out: NdarrayOrTensor |
| 1919 | if isinstance(k, torch.Tensor): |
| 1920 | out = torch.fft.ifftn(torch.fft.ifftshift(k, dim=dims), dim=dims, norm="backward").real |
| 1921 | else: |
| 1922 | out = np.fft.ifftn(np.fft.ifftshift(k, axes=dims), axes=dims).real |
| 1923 | return ascontiguousarray(out) if as_contiguous else out |
| 1924 | |
| 1925 | |
| 1926 | def get_number_image_type_conversions(transform: Compose, test_data: Any, key: Hashable | None = None) -> int: |