calc_projection_shell#
- pypulseqpp.calc_projection_shell()[source]#
Return a pole-to-pole base shell and z-axis rotations for each shot.
Rotated shells share both poles; each nonpolar ring has one spoke per shot.
- Parameters:
n_views (int) – Spokes in the base shell, at least three.
n_shots (int, default=1) – Number of rotated replays of the base shell, at least one.
scheme ({'spiral', 'quiet', 'meridian'}, default='spiral') –
'spiral'winds pole to pole across equal-area rings, so the shell alone is already near-uniform.'quiet'keeps the spiral’s rings and the directions the shots sample on them, but moves each ring’s spoke by whole shot turns to the one nearest its predecessor: the shell becomes a near-meridian whose steps are about one ring gap, instead of a stride across many rings’ worth of azimuth.'meridian'is a half great circle in the x-z plane at equal polar steps, which is simpler and oversamples the poles.
- Returns:
directions (numpy.ndarray) – Unit spoke directions of the base shell, shape
(n_views, 3).rotations (numpy.ndarray) – Rotation matrices, shape
(n_shots, 3, 3): rotations about the z axis by2*pi*k/n_shots,k = 0..n_shots-1. Each maps the whole base shell to the directions that shot samples.
- Raises:
ValueError – If
n_viewsis below 3,n_shotsis below 1 orschemeis unknown.
Examples
>>> import numpy as np >>> import pypulseqpp as pp >>> directions, rotations = pp.calc_projection_shell(32, n_shots=13) >>> directions.shape, rotations.shape ((32, 3), (13, 3, 3))
The shell runs pole to pole, so the shot rotations leave its ends alone:
>>> bool(np.allclose(directions[[0, -1]], [[0, 0, 1], [0, 0, -1]])) True
Consecutive
'spiral'views are exactly one step apart, so every turn between them is the same slew:>>> steps = np.arccos(np.clip(np.sum(directions[:-1] * directions[1:], axis=1), -1, 1)) >>> bool(np.ptp(steps) < 1e-9) True
'quiet'samples the same sphere with the shell’s steps a ring gap long:>>> quiet, _ = pp.calc_projection_shell(32, n_shots=13, scheme="quiet") >>> quiet_steps = np.arccos(np.clip(np.sum(quiet[:-1] * quiet[1:], axis=1), -1, 1)) >>> bool(np.median(quiet_steps) < np.median(steps) / 2) True
See also
calc_golden_anglesin-plane spoke angles, one per shot, for 2D radial.