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

Random sampling #220

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Random sampling #220

wants to merge 10 commits into from

Conversation

paquiteau
Copy link
Member

@paquiteau paquiteau commented Dec 2, 2024

This PR adds random sampling extension for trajectories.
In particular, it adds a trajectory expansion function (stack_random) to stack 2D trajectory following a certain distribution.

  • Add examples
  • ([ ] Add ND sampling (e.g poisson disc))

An example of stack of spiral with uniform sampling (but fully sampled in the center of k-space)
Screenshot From 2024-12-02 15-15-50

@paquiteau paquiteau requested a review from Daval-G December 2, 2024 13:51
Copy link
Collaborator

@Daval-G Daval-G left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea for an additional tool. A bunch of comments mostly about aligning this function with other similar tools and also avoiding redundancy with PR #206

src/mrinufft/trajectories/display.py Show resolved Hide resolved
src/mrinufft/trajectories/utils.py Show resolved Hide resolved
src/mrinufft/trajectories/tools.py Outdated Show resolved Hide resolved
src/mrinufft/trajectories/tools.py Show resolved Hide resolved
src/mrinufft/trajectories/tools.py Show resolved Hide resolved
if accel == 0:
return np.arange(dim_size) # type: ignore

indexes = list(range(dim_size))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pick positions over a discrete grid when uniform and gaussian pdfs are defined over continuous spaces ? We could remove dim_size entirely as it would be only relevant when pdf is an array which already contains dim_size in its shape

Copy link
Member Author

@paquiteau paquiteau Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. There are two reason: 1) this function was initially written 2 years ago for creating cartesian mask, and it evolved from there 2) this enforces a stacking that lies on the cartesian grid, making it suitable for Stacked-NUFFT (2.5 D) optimization.

A solution could be to resort to the continuous case if dim_size = None , but then accel does not make a lot of sense anymore (accelerating compared to the continuous kz is not defined)

src/mrinufft/trajectories/tools.py Outdated Show resolved Hide resolved
src/mrinufft/trajectories/tools.py Outdated Show resolved Hide resolved
src/mrinufft/trajectories/tools.py Outdated Show resolved Hide resolved
src/mrinufft/trajectories/tools.py Outdated Show resolved Hide resolved
@paquiteau
Copy link
Member Author

@Daval-G What do you think of this updated version ? also do not hesitate to check the example as well

@Daval-G
Copy link
Collaborator

Daval-G commented Jan 23, 2025

@paquiteau I am starting again to look at this request, but I won't finish tonight. I see that a bunch of my old comments are un-answered, could you have a look ? Thx

@paquiteau
Copy link
Member Author

I think now I have address everything you asked for :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants