How to use the torchkbnufft.functional.kbnufft.KbNufftFunction function in torchkbnufft

To help you get started, we’ve selected a few torchkbnufft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mmuckley / torchkbnufft / torchkbnufft / kbnufft.py View on Github external
Args:
            x (tensor): The original imagel.
            om (tensor, optional): A new set of omega coordinates at which to
                calculate the signal in radians/voxel.
            interp_mats (dict, default=None): A dictionary with keys
                'real_interp_mats' and 'imag_interp_mats', each key containing
                a list of interpolation matrices (see 
                mri.sparse_interp_mat.precomp_sparse_mats for construction).
                If None, then a standard interpolation is run.

        Returns:
            tensor: x computed at off-grid locations in om.
        """
        interpob = self._extract_nufft_interpob()

        y = KbNufftFunction.apply(x, om, interpob, interp_mats)

        return y
github mmuckley / torchkbnufft / torchkbnufft / mri / sensenufft_functions.py View on Github external
tensor: Output off-grid k-space data of dimensions (nbatch, ncoil, 2,
            klength).
    """
    if isinstance(smap, torch.Tensor):
        dtype = smap.dtype
        device = smap.device
        mult_x = torch.zeros(smap.shape, dtype=dtype, device=device)
    else:
        mult_x = [None] * len(smap)

    # handle batch dimension
    for i, im in enumerate(x):
        # multiply sensitivities
        mult_x[i] = complex_mult(im, smap[i], dim=1)

    y = KbNufftFunction.apply(mult_x, om, interpob, interp_mats)

    return y
github mmuckley / torchkbnufft / torchkbnufft / mri / sensenufft_functions.py View on Github external
Returns:
        tensor: Output off-grid k-space data of dimensions (nbatch, ncoil, 2,
            klength).
    """
    ncoil = smap.shape[1]

    # multiply coils
    x = complex_mult(x, smap, dim=2)

    # pack slice dim into coil dim
    new_sz = (1, -1, 2) + tuple(smap.shape[3:])
    x = x.view(*new_sz)

    # nufft
    y = KbNufftFunction.apply(x, om, interpob, interp_mats)

    # unpack slice dim from coil dim
    new_sz = (-1, ncoil, 2, y.shape[-1])
    y = y.view(*new_sz)

    return y