MRICufiNUFFT#

class mrinufft.operators.interfaces.cufinufft.MRICufiNUFFT(samples, shape, density=False, n_coils=1, n_batchs=1, smaps=None, smaps_cached=False, verbose=False, squeeze_dims=False, n_trans=1, **kwargs)[source]#

Bases: FourierOperatorBase

MRI Transform operator, build around cufinufft.

This operator adds density estimation and compensation (preconditioning) and multicoil support.

Parameters:
  • samples (np.ndarray or GPUArray.) – The samples location of shape Nsamples x N_dimensions.

  • shape (tuple) – Shape of the image space.

  • n_coils (int) – Number of coils.

  • n_batchs (int) – Size of the batch dimension.

  • density (bool or array) –

    Density compensation support.
    • If array, use this for density compensation

    • If True, the density compensation will be automatically estimated, using the fixed point method.

    • If False, density compensation will not be used.

  • smaps (np.ndarray or GPUArray , optional) –

    • If None: no Smaps wil be used.

    • If np.ndarray: Smaps will be copied on the device, according to smaps_cached.

    • If GPUArray, the smaps are already cached.

  • smaps_cached (bool, default False) –

    • If False the smaps are copied on device and free at each iterations.

    • If True, the smaps are copied on device and stay on it.

  • squeeze_dims (bool, default False) – If True, will try to remove the singleton dimension for batch and coils.

  • n_trans (int, default 1) – Number of transform to perform in parallel by cufinufft.

  • kwargs – Extra kwargs for the raw cufinufft operator

Notes

Cufinufft is able to run multiple transform in parallel, this is controlled by the n_trans parameter. The data provided should be of shape, (n_batch, n_coils, img_shape) for op (type2) and (n_batch, n_coils, n_samples) for adjoint (type1). and in contiguous memory order.

For now only single precision (float32 and complex64) is supported

See also

cufinufft.raw_operator.RawCufinufft

Methods

__init__

adj_op

Non Cartesian MRI adjoint operator.

check_shape

Validate the shapes of the image or k-space data against operator shapes.

compute_density

Compute the density compensation weights and set it.

compute_smaps

Compute the sensitivity maps and set it.

data_consistency

Compute the data consistency estimation directly on gpu.

get_lipschitz_cst

Return the Lipschitz constant of the operator.

make_autograd

Make a new Operator with autodiff support.

op

Non Cartesian MRI forward operator.

toggle_grad_traj

Toggle between the gradient trajectory and the plan for type 1 transform.

with_autograd

Return a Fourier operator with autograd capabilities.

with_off_resonance_correction

Return a new operator with Off Resonnance Correction.

Attributes

autograd_available

available

backend

bsize_img

Size in Bytes of the compute batch of images.

bsize_ksp

Size in Bytes of the compute batch of samples.

cpx_dtype

Return complex floating precision of the operator.

density

Density compensation of the operator.

dtype

Return floating precision of the operator.

eps

Return the underlying precision parameter.

img_size

Image size in bytes.

interfaces

ksp_size

k-space size in bytes.

n_coils

Number of coils for the operator.

n_samples

Return the number of samples used by the operator.

ndim

Number of dimensions in image space of the operator.

norm_factor

Norm factor of the operator.

samples

Return the samples used by the operator.

shape

Shape of the image space of the operator.

smaps

Sensitivity maps of the operator.

uses_density

Return True if the operator uses density compensation.

uses_sense

Return True if the operator uses sensitivity maps.

property smaps#

Sensitivity maps of the operator.

property samples#

Return the samples used by the operator.

property density#

Density compensation of the operator.

op(data, ksp_d=None)[source]#

Non Cartesian MRI forward operator.

Parameters:
  • data (np.ndarray or GPUArray)

  • space. (The uniform (2D or 3D) data in image)

Return type:

Results array on the same device as data.

Notes

this performs for every coil ell: ..math:: mathcal{F}mathcal{S}_ell x

adj_op(coeffs, img_d=None)[source]#

Non Cartesian MRI adjoint operator.

Parameters:

coeffs (np.array or GPUArray)

Return type:

Array in the same memory space of coeffs. (ie on cpu or gpu Memory).

_adj_op_sense_device(coeffs, img_d=None)[source]#

Perform sense reconstruction when data is on device.

_adj_op_sense_host(coeffs, img_d=None)[source]#

Perform sense reconstruction when data is on host.

On device the following array are involved: - coil_img(S, T, 1, X,Y,Z) - ksp_batch(B, 1, X,Y,Z) - smaps_batched(S, T, X,Y,Z) - density_batched(T, K)

data_consistency(image_data, obs_data)[source]#

Compute the data consistency estimation directly on gpu.

This mixes the op and adj_op method to perform F_adj(F(x-y)) on a per coil basis. By doing the computation coil wise, it uses less memory than the naive call to adj_op(op(x)-y)

Parameters:
  • image (array) – Image on which the gradient operation will be evaluated. N_coil x Image shape is not using sense.

  • obs_data (array) – Observed data.

_dc_sense_host(image_data, obs_data)[source]#

Gradient computation when all data is on host.

_dc_sense_device(image_data, obs_data)[source]#

Gradient computation when all data is on device.

_dc_calibless_host(image_data, obs_data)[source]#

Calibrationless Gradient computation when all data is on host.

_dc_calibless_device(image_data, obs_data)[source]#

Calibrationless Gradient computation when all data is on device.

_safe_squeeze(arr)[source]#

Squeeze the first two dimensions of shape of the operator.

property eps#

Return the underlying precision parameter.

property bsize_ksp#

Size in Bytes of the compute batch of samples.

property bsize_img#

Size in Bytes of the compute batch of images.

property img_size#

Image size in bytes.

property ksp_size#

k-space size in bytes.

property norm_factor#

Norm factor of the operator.

get_lipschitz_cst(max_iter=10, **kwargs)[source]#

Return the Lipschitz constant of the operator.

Parameters:
  • max_iter (int) – Number of iteration to perform to estimate the Lipschitz constant.

  • kwargs – Extra kwargs for the cufinufft operator.

Returns:

Lipschitz constant of the operator.

Return type:

float

toggle_grad_traj()[source]#

Toggle between the gradient trajectory and the plan for type 1 transform.