read_diffusion_table#
- pypulseqpp.io.read_diffusion_table()[source]#
Read a diffusion table: one b-value and one direction per volume.
Three layouts are read, told apart by the file:
x y z bper row (MRtrix’s layout), b in s/mm².An FSL pair, given as the
.bvecpath with the.bvalbeside it.A block direction table: one or more blocks, each a line holding a count N followed by N rows
x y z.directionspicks the block of that count, and a row’s b-value isb_value * (x² + y² + z²), so that shorter vectors make lower shells and a zero row a b = 0 volume.
#starts a comment, and values are separated by any whitespace.- Parameters:
path – The table file.
b_value (float, default=None) – Largest b-value (s/mm²), which a block direction table’s unit vectors reach. Required for that layout and ignored otherwise.
directions (int, default=None) – Count of the block to read from a block direction table; may be omitted when the file holds one block.
- Returns:
b (numpy.ndarray) –
(volumes,), s/mm².g (numpy.ndarray) –
(volumes, 3), unit directions along the sequence’s gradient channels x, y and z, and zero wherebis zero. Those channels turn with the prescription, so the directions are in its logical frame.
- Raises:
ValueError – If the file matches none of the layouts, a block direction table is read without
b_value, or no block hasdirectionsrows.