make_linear_order

make_linear_order#

pypulseqpp.make_linear_order()[source]#

Echo-train ordering of Cartesian views in linear (raster) order.

The views are ranked in raster order, by kz and then by ky, and the ranking is cut into train_length consecutive bands of ceil(N / train_length) views. Band e is acquired at echo e, one view per shot, dealt across the shots in ky order. This is scheme A (linear reordering) of Buonincontri et al., Fig. 2.

Parameters:
  • coords (array_like) – Centred coordinates of the selected views: an (N, 2) array of (ky, kz) or an (N,) array of ky, relative to the k-space centre, which is the origin. Encoded view indices (y, z) on an (n_y, n_z) grid convert as views - (n_y // 2, n_z // 2). Distances and angles are evaluated in the units supplied. Boolean masks are not accepted.

  • train_length (int) – Echo-train length, at least 1. The number of shots is ceil(N / train_length).

  • center_echo (int or None, default=None) – Echo at which the view nearest the origin is acquired, in [0, train_length). None keeps the bands in raster order; an integer rotates the band order so that the band containing that view is acquired at center_echo.

  • pad (bool, default=False) – Pad every train to train_length with None, so that the position in a train is the echo index. With False the None entries are removed.

Returns:

trains – trains[s][e] is the row index into coords of the view acquired at echo e of shot s. The values are indices, not coordinates; every row of coords appears exactly once. With pad=True, None marks an echo that acquires no view. Empty coords give [].

Return type:

list of list of int

Raises:
  • TypeError – If coords is a boolean mask or not numeric.

  • ValueError – If coords does not have shape (N,) or (N, 2), train_length is not a positive integer, or center_echo is outside [0, train_length).

Examples

Four centred views, two echoes per shot. Echo 0 acquires the kz = -1 band and echo 1 the kz = 0 band:

>>> import pypulseqpp as pp
>>> views = [(-1, -1), (0, -1), (-1, 0), (0, 0)]
>>> trains = pp.make_linear_order(views, 2)
>>> trains
[[0, 2], [1, 3]]
>>> [[views[i] for i in train] for train in trains]
[[(-1, -1), (-1, 0)], [(0, -1), (0, 0)]]