How to use the torchkbnufft.functional.kbnufft.AdjKbNufftFunction 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:
            y (tensor): The off-grid signal.
            om (tensor, optional): The off-grid coordinates 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: The image after adjoint NUFFT.
        """
        interpob = self._extract_nufft_interpob()

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

        return x
github mmuckley / torchkbnufft / torchkbnufft / mri / sensenufft_functions.py View on Github external
interp_mats (dictionary, default=None): A dictionary of sparse
            interpolation matrices. If not None, the NUFFT operation will use
            the matrices for interpolation.

    Returns:
        tensor: The images after adjoint NUFFT of size (nbatch, ncoil, 2) +
            im_size.
    """
    ncoil = smap.shape[1]

    # pack slice dim into coil dim
    new_sz = (1, -1, 2, y.shape[-1])
    y = y.view(*new_sz)

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

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

    # conjugate sum
    x = torch.sum(conj_complex_mult(x, smap, dim=2), dim=1, keepdim=True)

    return x
github mmuckley / torchkbnufft / torchkbnufft / mri / sensenufft_functions.py View on Github external
Args:
        y (tensor): The input images of size (nbatch, ncoil, 2, klength).
        smap (tensor): The sensitivity maps of size (nbatch, ncoil, 2) +
            im_size.
        interpob (dictionary): A NUFFT interpolation object.
        interp_mats (dictionary, default=None): A dictionary of sparse
            interpolation matrices. If not None, the NUFFT operation will use
            the matrices for interpolation.

    Returns:
        tensor: The images after adjoint NUFFT of size (nbatch, ncoil, 2) +
            im_size.
    """
    # adjoint nufft
    x = AdjKbNufftFunction.apply(y, om, interpob, interp_mats)

    # conjugate sum
    x = list(x)
    for i in range(len(x)):
        x[i] = torch.sum(conj_complex_mult(
            x[i], smap[i], dim=1), dim=0, keepdim=True)

    if isinstance(smap, torch.Tensor):
        x = torch.stack(x)

    return x