MRITorchKbNufft#
- class mrinufft.operators.interfaces.torchkbnufft.MRITorchKbNufft(samples, shape, density=False, n_coils=1, n_batchs=1, smaps=None, eps=1e-06, squeeze_dims=True, use_gpu=False, osf=2, **kwargs)[source]#
Bases:
FourierOperatorBaseMRI Transform Operator using Torch NUFFT.
This class provides a Non-Uniform Fast Fourier Transform (NUFFT) operator for MRI data, utilizing the torchkbnufft library for performing the computations. It supports both CPU and GPU computations.
- Parameters:
samples (Tensor) – The sample locations of shape
Nsamples x N_dimensions. It should be C-contiguous.shape (tuple) – Shape of the image space.
density (bool or Tensor, optional) – Density compensation support. Default is False. - If a Tensor, it will be used for density. - If True, the density compensation will be automatically estimated using the fixed point method (“pipe”). - If False, density compensation will not be used.
n_coils (int, optional) – Number of coils. Default is 1.
n_batchs (int, optional) – Number of batches. Default is 1.
smaps (Tensor, optional) – Sensitivity maps. Default is None.
eps (float, optional) – A small epsilon value for numerical stability. Default is 1e-6.
squeeze_dims (bool, optional) – If True, tries to remove singleton dimensions for batch and coils. Default is True.
use_gpu (bool, optional) – Whether to use the GPU. Default is False.
osf (int, optional) – Oversampling factor. Default is 2.
**kwargs (dict) – Additional keyword arguments.
Methods
__init__Backward Operation.
cgConjugate Gradient method to solve the inverse problem.
check_shapeValidate the shapes of the image or k-space data against operator shapes.
compute_densityCompute the density compensation weights and set it.
compute_smapsCompute the sensitivity maps and set it.
Compute the data consistency.
get_lipschitz_cstReturn the Lipschitz constant of the operator.
make_autogradMake a new Operator with autodiff support.
Forward operation.
Compute the density compensation weights for a given set of kspace locations.
with_autogradReturn a Fourier operator with autograd capabilities.
with_off_resonance_correctionReturn a new operator with Off Resonnance Correction.
Attributes
autograd_availableavailablecpx_dtypeReturn complex floating precision of the operator.
densityDensity compensation of the operator.
dtypeReturn floating precision of the operator.
interfacesn_batchsNumber of coils for the operator.
n_coilsNumber of coils for the operator.
n_samplesReturn the number of samples used by the operator.
ndimNumber of dimensions in image space of the operator.
norm_factorNormalization factor of the operator.
samplesReturn the samples used by the operator.
shapeShape of the image space of the operator.
smapsSensitivity maps of the operator.
uses_densityReturn True if the operator uses density compensation.
uses_senseReturn True if the operator uses sensitivity maps.
backend- op(data, out=None)[source]#
Forward operation.
- Parameters:
data (Tensor)
- Returns:
Tensor
- Return type:
Non-uniform Fourier transform of the input image.
Note
This function uses
torchinternally, and will convert all its array argument to torch tensors, but will respect the device they are allocated on. The outputs will be converted back to the original array module and device.
- adj_op(coeffs, out=None)[source]#
Backward Operation.
- Parameters:
coeffs (Tensor)
- Return type:
Tensor
Note
This function uses
torchinternally, and will convert all its array argument to torch tensors, but will respect the device they are allocated on. The outputs will be converted back to the original array module and device.
- data_consistency(data, obs_data)[source]#
Compute the data consistency.
- Parameters:
data (Tensor) – Image data
obs_data (Tensor) – Observed data
- Returns:
The data consistency error in image space.
- Return type:
Tensor
Note
This function uses
torchinternally, and will convert all its array argument to torch tensors, but will respect the device they are allocated on. The outputs will be converted back to the original array module and device.
- classmethod pipe(kspace_loc, volume_shape, num_iterations=10, osf=2, normalize=True, use_gpu=False, **kwargs)[source]#
Compute the density compensation weights for a given set of kspace locations.
- Parameters:
kspace_loc (Tensor) – the kspace locations
volume_shape (tuple) – the volume shape
num_iterations (int default 10) – the number of iterations for density estimation
osf (float or int) – The oversampling factor the volume shape
normalize (bool) – Whether to normalize the density compensation. We normalize such that the energy of PSF = 1
use_gpu (bool, default False) – Whether to use the GPU
Note
This function uses
torchinternally, and will convert all its array argument to torch tensors, but will respect the device they are allocated on. The outputs will be converted back to the original array module and device.