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

Add option for full-spoke radial trajectory #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions sigpy/mri/samp.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def poisson(img_shape, accel, calib=(0, 0), dtype=np.complex,
return mask


def radial(coord_shape, img_shape, golden=True, dtype=np.float):
def radial(coord_shape, img_shape, golden=True, half_spoke=True, dtype=np.float32):
"""Generate radial trajectory.

Args:
Expand All @@ -96,6 +96,7 @@ def radial(coord_shape, img_shape, golden=True, dtype=np.float):
and ndim is the number of dimensions.
img_shape (tuple of ints): image shape.
golden (bool): golden angle ordering.
half_spoke (bool): center-out trajectory.
dtype (Dtype): data type.

Returns:
Expand All @@ -119,13 +120,18 @@ def radial(coord_shape, img_shape, golden=True, dtype=np.float):

ntr, nro, ndim = coord_shape
if ndim == 2:
if golden:
if half_spoke:
n, r = np.mgrid[:ntr, :0.5:0.5 / nro]
else:
n, r = np.mgrid[:ntr, -0.5:0.5:1.0 / nro]

if golden and half_spoke:
phi = np.pi * (3 - 5**0.5)
elif golden and not half_spoke:
phi = np.pi * (5**0.5 - 1)*0.5
else:
phi = 2 * np.pi / ntr

n, r = np.mgrid[:ntr, :0.5:0.5 / nro]

theta = n * phi
coord = np.zeros((ntr, nro, 2))
coord[:, :, -1] = r * np.cos(theta)
Expand All @@ -138,9 +144,13 @@ def radial(coord_shape, img_shape, golden=True, dtype=np.float):
else:
raise NotImplementedError

n, r = np.mgrid[:ntr, :0.5:0.5 / nro]
if half_spoke:
n, r = np.mgrid[:ntr, :0.5:0.5 / nro]
beta = np.arccos(2 * ((n * phi1) % 1) - 1)
else:
n, r = np.mgrid[:ntr, -0.5:0.5:1.0 / nro]
beta = np.arccos((n * phi1) % 1)

beta = np.arccos(2 * ((n * phi1) % 1) - 1)
alpha = 2 * np.pi * ((n * phi2) % 1)

coord = np.zeros((ntr, nro, 3))
Expand Down