-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quick utils functions to get B and C matrices from off-resonance maps #124
Comments
I fully agree with you. Getting the off resonance map from the k space data could be done in the extras module, just as we propose it for the smaps estimation. We may also wish to have autodiff support around this as well ? |
Sure. But note that the estimation isnt trivial, it is computationally expensive (for now). @Daval-G you think these codes can be open sourced though? I wanted to confirm that. |
I agree with @paquiteau : Estimation of off-resonance effects from k-space data should be carried out separately, as it depends on the phase information usually extracted from the image domain and TE value. |
This add "get_interpolators_from_fieldmap", supporting both real (B0 map only) and complex (Zmap = R2* + 1j * B0map) fields in arbitrary dimension (2D and 3D). The routine supports both numpy / cupy arrays and torch tensors on CPU and GPU, the latter requiring cupy due to limitations in torch.histogram / torch.histogramdd (pytorch/pytorch#69519). Calculation uses time segmentation with uniform time samples and LS coefficients (using histogram). Based on MIRT (https://github.com/JeffFessler/mirt/blob/main/mri/mri_exp_approx.m) and its Python porting from MIRTORCH (https://github.com/guanhuaw/MIRTorch/blob/master/mirtorch/linear/mri.py) and SigPy (https://github.com/mikgroup/sigpy/blob/main/sigpy/mri/util.py).
* fix typoes (off_resonnance -> off_resonance) * feat: add field interpolators calculation (#124) This add "get_interpolators_from_fieldmap", supporting both real (B0 map only) and complex (Zmap = R2* + 1j * B0map) fields in arbitrary dimension (2D and 3D). The routine supports both numpy / cupy arrays and torch tensors on CPU and GPU, the latter requiring cupy due to limitations in torch.histogram / torch.histogramdd (pytorch/pytorch#69519). Calculation uses time segmentation with uniform time samples and LS coefficients (using histogram). Based on MIRT (https://github.com/JeffFessler/mirt/blob/main/mri/mri_exp_approx.m) and its Python porting from MIRTORCH (https://github.com/guanhuaw/MIRTorch/blob/master/mirtorch/linear/mri.py) and SigPy (https://github.com/mikgroup/sigpy/blob/main/sigpy/mri/util.py). * feat: field interpolator estimation in MRIFourierCorrected constructor. In addition, add off-resonance example. * feat: set autograd_available based on base FourierOperator * Update test_offres_exp_approx.py Avoid torch cuda test case if cupy is not available. * Update src/mrinufft/operators/off_resonance.py remove deprecated get_grad Co-authored-by: Chaithya G R <[email protected]> * address pr review * remove phantominator * remove duplicated example and replacing subject in example_offres * address PR rev #2 * \!docs_build and fix on \!style * \!docs_build * skip field coefficient gpu test case if cupy not available * \!docs_build fix gpuNUFFT * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * \!docs_build gpunufft * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * address PR rev 3 * Update pyproject.toml * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * \![docs_build] * temp, \![docs_build] fix * fix cufinufft, \!docs_build fix --------- Co-authored-by: Chaithya G R <[email protected]> Co-authored-by: Guillaume Daval-Frérot <[email protected]>
* fix typoes (off_resonnance -> off_resonance) * feat: add field interpolators calculation (#124) This add "get_interpolators_from_fieldmap", supporting both real (B0 map only) and complex (Zmap = R2* + 1j * B0map) fields in arbitrary dimension (2D and 3D). The routine supports both numpy / cupy arrays and torch tensors on CPU and GPU, the latter requiring cupy due to limitations in torch.histogram / torch.histogramdd (pytorch/pytorch#69519). Calculation uses time segmentation with uniform time samples and LS coefficients (using histogram). Based on MIRT (https://github.com/JeffFessler/mirt/blob/main/mri/mri_exp_approx.m) and its Python porting from MIRTORCH (https://github.com/guanhuaw/MIRTorch/blob/master/mirtorch/linear/mri.py) and SigPy (https://github.com/mikgroup/sigpy/blob/main/sigpy/mri/util.py). * feat: field interpolator estimation in MRIFourierCorrected constructor. In addition, add off-resonance example. * feat: set autograd_available based on base FourierOperator * Update test_offres_exp_approx.py Avoid torch cuda test case if cupy is not available. * Update src/mrinufft/operators/off_resonance.py remove deprecated get_grad Co-authored-by: Chaithya G R <[email protected]> * address pr review * remove phantominator * remove duplicated example and replacing subject in example_offres * address PR rev #2 * \!docs_build and fix on \!style * \!docs_build * enhancement: refactor with_* decorator to support standalone functions. * skip field coefficient gpu test case if cupy not available * \!docs_build fix gpuNUFFT * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * \!docs_build gpunufft * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * Update src/mrinufft/operators/off_resonance.py Co-authored-by: Guillaume Daval-Frérot <[email protected]> * address PR rev 3 * sync with off_resonance PR rev * feat: handle kwargs only input. * fix: decorators now working if required_grad is True * sync with master * Update src/mrinufft/operators/base.py Co-authored-by: Pierre-Antoine Comby <[email protected]> * refactor: array interface conversion in separate module. * lint tfnufft * remove print statements * Update src/mrinufft/_array_compat.py Co-authored-by: Pierre-Antoine Comby <[email protected]> * Update src/mrinufft/_array_compat.py Co-authored-by: Pierre-Antoine Comby <[email protected]> * Update src/mrinufft/_array_compat.py Co-authored-by: Pierre-Antoine Comby <[email protected]> * enhance: handle kwargs and (nested) tuple/lists of arraylike arguments. * update base.py * Update src/mrinufft/_array_compat.py Co-authored-by: Pierre-Antoine Comby <[email protected]> * apply suggested refactor to each decorator. --------- Co-authored-by: Chaithya G R <[email protected]> Co-authored-by: Guillaume Daval-Frérot <[email protected]> Co-authored-by: Pierre-Antoine Comby <[email protected]>
Currently, in
mri-nufft/src/mrinufft/operators/off_resonnance.py
Lines 19 to 58 in f5a6ba0
we just generate the fourier_op which takes the B and C values into account.
mrinufft.operators.off_resonance
calledget_interpolators_from_fieldmap
.MRIFourierCorrected(fourier_op, b0_field, mask)
The text was updated successfully, but these errors were encountered: