FourierOperatorBase#
- class mrinufft.operators.base.FourierOperatorBase[source]#
Bases:
ABC
Base Fourier Operator class.
Every (Linear) Fourier operator inherits from this class, to ensure that we have all the functions rightly implemented as required by ModOpt.
Methods
__init__
Compute adjoint operator transform.
Validate the shapes of the image or k-space data against operator shapes.
Compute the density compensation weights and set it.
Compute the sensitivity maps and set it.
Compute the gradient data consistency.
Return the Lipschitz constant of the operator.
Make a new Operator with autodiff support.
Compute operator transform.
Return a Fourier operator with autograd capabilities.
Return a new operator with Off Resonnance Correction.
Attributes
autograd_available
Return complex floating precision of the operator.
Density compensation of the operator.
Return floating precision of the operator.
interfaces
Number of coils for the operator.
Return the number of samples used by the operator.
Number of dimensions in image space of the operator.
Normalization factor of the operator.
Return the samples used by the operator.
Shape of the image space of the operator.
Sensitivity maps of the operator.
Return True if the operator uses density compensation.
Return True if the operator uses sensitivity maps.
- check_shape(*, image=None, ksp=None)[source]#
Validate the shapes of the image or k-space data against operator shapes.
- Parameters:
image (np.ndarray, optional) – If passed, the shape of image data will be checked.
ksp (np.ndarray or object, optional) – If passed, the shape of the k-space data will be checked.
- Raises:
ValueError – If the shape of the provided image does not match the expected operator shape, or if the number of k-space samples does not match the expected number of samples.
- abstract op(data)[source]#
Compute operator transform.
- Parameters:
data (np.ndarray) – input as array.
- Returns:
result – operator transform of the input.
- Return type:
np.ndarray
- abstract adj_op(coeffs)[source]#
Compute adjoint operator transform.
- Parameters:
x (np.ndarray) – input data array.
- Returns:
results – adjoint operator transform.
- Return type:
np.ndarray
- data_consistency(image, obs_data)[source]#
Compute the gradient data consistency.
This is the naive implementation using adj_op(op(x)-y). Specific backend can (and should!) implement a more efficient version.
- with_off_resonance_correction(B, C, indices)[source]#
Return a new operator with Off Resonnance Correction.
- compute_smaps(method=None)[source]#
Compute the sensitivity maps and set it.
- Parameters:
method (callable or dict or array) – The method to use to compute the sensitivity maps. If an array, it should be of shape (NCoils,XYZ) and will be used as is. If a dict, it should have a key ‘name’, to determine which method to use. other items will be used as kwargs. If a callable, it should take the samples and the shape as input. Note that this callable function should also hold the k-space data (use funtools.partial)
- make_autograd(wrt_data=True, wrt_traj=False)[source]#
Make a new Operator with autodiff support.
- Parameters:
- Returns:
A NUFFT operator with autodiff capabilities.
- Return type:
torch.nn.module
- Raises:
ValueError – If autograd is not available.
- compute_density(method=None)[source]#
Compute the density compensation weights and set it.
- Parameters:
method (str or callable or array or dict or bool) –
The method to use to compute the density compensation. If a string, the method should be registered in the density registry. If a callable, it should take the samples and the shape as input. If a dict, it should have a key ‘name’, to determine which method to use. other items will be used as kwargs. If an array, it should be of shape (Nsamples,) and will be used as is. If True, the method pipe is chosen as default estimation method, if backend is tensorflow, gpunufft or torchkbnufft-cpu
or torchkbnufft-gpu.
- get_lipschitz_cst(max_iter=10, **kwargs)[source]#
Return the Lipschitz constant of the operator.
- Parameters:
max_iter (int) – number of iteration to compute the lipschitz constant.
**kwargs – Extra arguments givent
- Returns:
Spectral Radius
- Return type:
Notes
This uses the Iterative Power Method to compute the largest singular value of a minified version of the nufft operator. No coil or B0 compensation is used, but includes any computed density.
- property uses_sense#
Return True if the operator uses sensitivity maps.
- property uses_density#
Return True if the operator uses density compensation.
- property ndim#
Number of dimensions in image space of the operator.
- property shape#
Shape of the image space of the operator.
- property n_coils#
Number of coils for the operator.
- property smaps#
Sensitivity maps of the operator.
- property density#
Density compensation of the operator.
- property dtype#
Return floating precision of the operator.
- property cpx_dtype#
Return complex floating precision of the operator.
- property samples#
Return the samples used by the operator.
- property n_samples#
Return the number of samples used by the operator.
- property norm_factor#
Normalization factor of the operator.