-
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 3D wave caipi #38
Conversation
Yay, thanks a lot for this !
Regards
Chaithya G R
…On Tue, 10 Oct 2023, 2:52 am Guillaume Daval-Frérot, < ***@***.***> wrote:
This PR adds the 3D Wave-CAIPI trajectory based on the work from Bilgic,
Berkin, Borjan A. Gagoski, Stephen F. Cauley, Audrey P. Fan, Jonathan R.
Polimeni, P. Ellen Grant, Lawrence L. Wald, and Kawin Setsompop.
"Wave‐CAIPI for highly accelerated 3D imaging." Magnetic resonance in
medicine 73, no. 6 (2015): 2152-2162. This implementation includes
additional features:
- a parameter to choose the packing method, defining how the different
helices should be positioned (i.e. following square or hexagonal tiling,
over concentric circles or randomly)
- a parameter to choose the shape covered over the kx-ky plane
(circle, square, diamond or anything defined through p-norms)
Hereafter is a simple rendering with a square tiling of a circle, shown in
3D and over the kx-ky 2D plane.
[image: image]
<https://user-images.githubusercontent.com/20557033/273699566-9ad47394-791d-4380-8238-91f22663917f.png>
[image: image]
<https://user-images.githubusercontent.com/20557033/273699619-46f0f59c-f298-4d16-96d9-89b76fbe0797.png>
------------------------------
You can view, comment on, or merge this pull request online at:
#38
Commit Summary
- 003b441
<003b441>
Add 3D wave caipi
File Changes
(2 files <https://github.com/mind-inria/mri-nufft/pull/38/files>)
- *M* src/mrinufft/trajectories/trajectory3D.py
<https://github.com/mind-inria/mri-nufft/pull/38/files#diff-439d40c06385e2982bedf92440cca8f89dfbc1d4e227f3178f9cc3e54981be92>
(68)
- *M* src/mrinufft/trajectories/utils.py
<https://github.com/mind-inria/mri-nufft/pull/38/files#diff-b1daaaba004de808aadd34c9c51a89db5aeb2201e48a6758f413d6198e89f576>
(13)
Patch Links:
- https://github.com/mind-inria/mri-nufft/pull/38.patch
- https://github.com/mind-inria/mri-nufft/pull/38.diff
—
Reply to this email directly, view it on GitHub
<#38>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBSZM65SW7G63BBGEMAPCTX6RTKJAVCNFSM6AAAAAA5ZLRCH6VHI2DSMVQWIX3LMV43ASLTON2WKOZRHEZTGOBUGE4DGNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Impressive Guillaume! Many thanks |
Nice work ! I think we should also propose the canonical way of reconstructing data acquired with this trajectory (e.g FFTs and PSF deconvolution) even if its only using a dummy numpy backend, and this also open the possibility to compare it with a NUFFT based reconstruction. |
That's a great suggestion for a future PR. I don't personally plan to work on that soon, should we create an issue to keep that in mind ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments...
For the FFT I have already some code pending in pysap-fmri, that would be happy to move here (with sense support etc...). For the PSF stuff I guess we would need to find some existing implementation to adapt.
# Ruff doesn't like lambdas | ||
def _sort_main(x): | ||
return nl.norm(x, ord=order) | ||
|
||
def _sort_tie(x): | ||
return nl.norm(x, ord=tie_order) | ||
|
||
positions = np.array(positions) * spacing | ||
positions = sorted(positions, key=_sort_tie) | ||
positions = sorted(positions, key=_sort_main) | ||
positions = positions[:Nc] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A functools.partial
will do the trick (needs to be imported on top though)
# Ruff doesn't like lambdas | |
def _sort_main(x): | |
return nl.norm(x, ord=order) | |
def _sort_tie(x): | |
return nl.norm(x, ord=tie_order) | |
positions = np.array(positions) * spacing | |
positions = sorted(positions, key=_sort_tie) | |
positions = sorted(positions, key=_sort_main) | |
positions = positions[:Nc] | |
positions = np.array(positions) * spacing | |
positions = sorted(positions, key=partial(nl.norm, ord=order)) | |
positions = sorted(positions, key=partial(nl.norm, ord=tie_order)) | |
positions = positions[:Nc] |
src/mrinufft/trajectories/utils.py
Outdated
if not isinstance(shape, str): | ||
return shape | ||
elif shape in ["square"]: | ||
return np.inf | ||
elif shape in ["circle", "circular"]: | ||
return 2 | ||
elif shape in ["rhombus", "diamond"]: | ||
return 1 | ||
else: | ||
raise NotImplementedError(f"Unknown shape name: {shape}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need the redundancy of "circle/circular" and "rhombus/diamon" ? a single possibility would leads to less ambiguity.
if not isinstance(shape, str): | |
return shape | |
elif shape in ["square"]: | |
return np.inf | |
elif shape in ["circle", "circular"]: | |
return 2 | |
elif shape in ["rhombus", "diamond"]: | |
return 1 | |
else: | |
raise NotImplementedError(f"Unknown shape name: {shape}") | |
SHAPE = {"circle": 2, "square": np.inf, "diamond": 1} # an enum would be overkill | |
if not isinstance(shape,str): | |
return shape | |
try: | |
return SHAPE[shape] | |
except KeyError as e: | |
raise Value(f"Unknown shape name: {shape}") from e |
This PR adds the 3D Wave-CAIPI trajectory based on the work from Bilgic, Berkin, Borjan A. Gagoski, Stephen F. Cauley, Audrey P. Fan, Jonathan R. Polimeni, P. Ellen Grant, Lawrence L. Wald, and Kawin Setsompop. "Wave‐CAIPI for highly accelerated 3D imaging." Magnetic resonance in medicine 73, no. 6 (2015): 2152-2162. This implementation includes additional features:
Hereafter is a simple rendering with a square tiling of a circle, shown in 3D and over the kx-ky 2D plane.