Skip to content
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

Fibonacci patch #86

Merged
merged 20 commits into from
Apr 5, 2024
Merged

Fibonacci patch #86

merged 20 commits into from
Apr 5, 2024

Conversation

Daval-G
Copy link
Collaborator

@Daval-G Daval-G commented Apr 3, 2024

This PR patches the bug from issue #72 and changes a few features. Most of them are related to the use of Fibonacci lattices, hence the name:

  • The precess tool was previously introduced mainly to provide a way to rotate shots such as 3D Cones and Seiffert spirals following the Fibonacci sphere lattice approximation to provide a mostly uniform distribution of shots over the k-space sphere. However it was subtly wrong in the way polar angles were handled, as shown below with the clouds of points used to rotate single shots. It resulted in a greater density around the precession axis instead:
    Previously wrong method:
    01
    New correct method:
    02
    The reason was simply that the kz coordinate was handled in a polar fashion rather than an axial fashion, as shown below. Now both options are available, and the precess tool is designed to provide a proper Fibonacci sphere distribution with its default arguments. The examples were also largely extended to better explain this tool.
    Previously wrong method (polar partition):
    08
    New correct method (axial partition):
    07
  • All rotation and prime number-related functions used in trajectories were moved to a new maths.py file. The Rv function that returns a rotation matrix based on two vectors using Rodrigues' rotation coefficients now handles properly co-linear cases, and a new function has been added to provide rotation matrices around arbitrary vectors (used in Seiffert spirals).
  • Functions are now provided in maths.py to generate Fibonacci square, circle and sphere lattices. Those are used to approximate analytically a uniform distribution of shot positions/orientations, typically over a sphere surface.
  • 3D Cones trajectory is now based on initialize_2D_spiral (which extend considerably its customization), but also the conify tool, which solves the problem signaled in issue Trajectory issue: Min value out of [-0.5,0.5] range #72, and the fixed precess tool with proper Fibonacci sphere lattice.
  • Wave-CAIPI trajectory has a new "fibonacci" packing option based on Fibonacci circle lattice.
  • Seiffert spirals are more closely following the original paper, with spiral precessions based on their own axes using the newly fixed precess tool with proper Fibonacci sphere lattice, but also around their own axes to avoid azimuthal redundancy, following authors methodology.
  • FLORET trajectory initialization has been changed to better match the definition from its original paper and avoid confusion on its nature compared to similar trajectories also available (conic spirals/stack of cones, for example).

@Daval-G Daval-G added bug Something isn't working feature request New feature or request trajectories Issues concerning Non cartesian trajectories labels Apr 3, 2024
@Daval-G Daval-G requested a review from paquiteau April 3, 2024 20:18
@Daval-G Daval-G self-assigned this Apr 3, 2024
@paquiteau
Copy link
Member

Awesome stuff ! I have made small suggestions, but overall this is good for me :)

@philouc
Copy link
Collaborator

philouc commented Apr 4, 2024

Congrats @Daval-G for this awesome upgrade on handling 3D Cone trajectories!

@Daval-G Daval-G requested a review from paquiteau April 5, 2024 16:23
@paquiteau
Copy link
Member

LGTM !

@paquiteau paquiteau merged commit a12ee65 into mind-inria:master Apr 5, 2024
5 of 7 checks passed
chaithyagr pushed a commit to chaithyagr/mri-nufft that referenced this pull request Apr 11, 2024
* Fix wrong concatenation with initial gradients & slew rates

* Clean FLORET trajectory, improve 3D cones & Seiffert spirals with proper Fibonacci lattice

* Update examples

* Add Fibonacci lattice functions, move maths functions into new file

* Black & ruff

* Fix tilt initialization errors with number.Number

* Add math function to rotate around an arbitrary axis

* Add Seiffert spiral rotation, Wave-CAIPI Fibonacci packing, and generalize axis selection in precess tool

* Apply black & ruff, add missing docstrings

* Update Wave-CAIPI examples, update init files to include tools

* Update FLORET and Precess examples

* Update 3D Cones and Conify examples

* Update Seiffert spiral documentation and examples

* Applied black & ruff for format

* Integrate colinear rotations into Rodrigues'coeff function

* Update precess documentation and fix minor bugs

* Update and extend precess examples

* Re-apply black & ruff check

* Remove internal GCD function, check Real instead of Numbers

---------

Co-authored-by: Guillaume DAVAL-FREROT <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request New feature or request trajectories Issues concerning Non cartesian trajectories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants