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:
FourierOperatorBaseMRI 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.RawCufinufftMethods
__init__Non Cartesian MRI adjoint operator.
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 estimation directly on gpu.
Return the Lipschitz constant of the operator.
make_autogradMake a new Operator with autodiff support.
Non Cartesian MRI forward operator.
Compute the density compensation weights for a given set of kspace locations.
Toggle between the gradient trajectory and the plan for type 1 transform.
with_autogradReturn a Fourier operator with autograd capabilities.
with_off_resonance_correctionReturn a new operator with Off Resonnance Correction.
Attributes
autograd_availableavailablebackendSize in Bytes of the compute batch of images.
Size in Bytes of the compute batch of samples.
cpx_dtypeReturn complex floating precision of the operator.
Density compensation of the operator.
dtypeReturn floating precision of the operator.
Return the underlying precision parameter.
Image size in bytes.
interfacesk-space size in bytes.
n_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 factor of the operator.
Return the samples used by the operator.
shapeShape of the image space of the operator.
Sensitivity maps of the operator.
uses_densityReturn True if the operator uses density compensation.
uses_senseReturn True if the operator uses sensitivity maps.
Examples using
mrinufft.operators.interfaces.cufinufft.MRICufiNUFFT#- 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
Note
This function uses
numpyfor all CPU arrays, andcupyfor all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.
- 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).
Note
This function uses
numpyfor all CPU arrays, andcupyfor all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.
- _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_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.
- 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.
- toggle_grad_traj()[source]#
Toggle between the gradient trajectory and the plan for type 1 transform.
- classmethod pipe(kspace_loc, volume_shape, num_iterations=10, osf=2, normalize=True, **kwargs)[source]#
Compute the density compensation weights for a given set of kspace locations.
- Parameters:
kspace_loc (np.ndarray) – the kspace locations
volume_shape (np.ndarray) – 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