make_shuffling_order#
- pypulseqpp.make_shuffling_order()[source]#
Echo-train ordering of Cartesian views with random echo positions.
This is the echo ordering used by T2 Shuffling [1]. With
cluster=True, train membership is formed from contiguous views in raster order (kz, thenky); echo positions within each train are randomly permuted. Withcluster=False, train membership is a random partition of the views as well.The routine orders views that are already selected; it does not select a variable-density support.
make_cartesian_plane_samplingwithsampling='poisson'selects such a support.- Parameters:
coords (array_like) – Centred coordinates of the selected views: an
(N, 2)array of(ky, kz)or an(N,)array ofky, relative to the k-space centre, which is the origin. Encoded view indices(y, z)on an(n_y, n_z)grid convert asviews - (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).seed (int or None, default=None) – Seed of the random permutations. Equal seeds give equal orders.
cluster (bool, default=True) – Form each train from contiguous views in raster order; when
False, assign views to trains at random.pad (bool, default=False) – Pad every train to
train_lengthwithNone, so that the position in a train is the echo index. WithFalsetheNoneentries are removed.
- Returns:
trains –
trains[s][e]is the row index intocoordsof the view acquired at echoeof shots. The values are indices, not coordinates; every row ofcoordsappears exactly once. Withpad=True,Nonemarks an echo that acquires no view. Emptycoordsgive[].- Return type:
- Raises:
TypeError – If
coordsis a boolean mask or not numeric.ValueError – If
coordsdoes not have shape(N,)or(N, 2), ortrain_lengthis not a positive integer.
See also
make_linear_orderthe same train membership in raster echo order.
References
Examples
Six centred
kyviews in two shots of three echoes. Each shot contains a contiguous group of views; the echo at which each view is acquired is random:>>> import pypulseqpp as pp >>> views = [-3, -2, -1, 0, 1, 2] >>> trains = pp.make_shuffling_order(views, 3, seed=0) >>> trains [[2, 0, 1], [5, 4, 3]] >>> [[views[i] for i in train] for train in trains] [[-1, -3, -2], [2, 1, 0]]
Another seed keeps the train membership and changes the echo positions:
>>> other = pp.make_shuffling_order(views, 3, seed=1) >>> [[views[i] for i in train] for train in other] [[-3, -2, -1], [2, 0, 1]]