Sequence description#
TL;DR
A sequence description is one repetition as WAIT, RF and ADC events, timestamped in microseconds, with the RF definitions its pulses name.
A Pulseq file and the MRD stream pulserver sends are read into the same
SequenceDescription.Gradients are not events: the handlers of the simulator a description is given to supply the dephasing.
You can simulate a sequence written elsewhere, from its Pulseq file or from the stream a scanner sends during the acquisition, without restating its parameters. This page states what such a description gives a simulator. How the handlers then play it is on Signal model; the reading rules and the wire format are in Sequence description: reading rules.
Capabilities#
Reads one repetition of a Pulseq file, as many blocks as its
TRSizedefinition states, one event per block.Show code and tests
Code:
from_pulseq(). Tests: the stream is the blocks the file lists; a file without a declared repetition is refused (test_pulseq_reader.py).Reads a sequence held in memory by pypulseq or pypulseqpp as it reads the file that sequence writes.
Show code and tests
Code:
from_pulseq(). Test: a sequence in memory reads as the file it writes (test_pulseq_reader.py).Takes the repetition named by
tr_indexor by the file’sTRRef, and otherwise the first that acquires, provided every repetition plays the same pulses.Show code and tests
Code:
read_pulseq_description. Test: naming a repetition out of range is refused (test_pulseq_reader.py).Stamps an RF event at the isocentre of its pulse, with the flip angle the envelope integrates to on the declared RF raster.
Show code and tests
Code:
rf_definition(). Tests: the pulse reads back at the angle it was written at (test_pulseq_reader.py); the dwell need not be the raster (test_rf_definition.py).Makes a pulse played under a slice-select gradient slice selective, with slice positions in units of the excitation’s thickness.
Show code and tests
Code:
read_pulseq_description. Tests: a pulse under a slice select gradient selects the slice it was designed for; a slice selective pulse from a file excites only its slice (test_pulseq_reader.py).Stamps an ADC event at the sample where its readout crosses the k-space centre, found on the gradient trajectory.
Show code and tests
Code:
read_pulseq_description. Test: the echo sits where the trajectory crosses zero (test_pulseq_reader.py).Flags the readouts that pass through \(k = 0\), which
record="echo"keeps.Show code and tests
Code:
read_pulseq_description,EpgEngine.simulate. Tests: only the readout that crosses zero is an echo; recording echoes keeps the central readout alone (test_pulseq_reader.py).Decodes the description pulserver sends on an MRD stream, one per file of the sequence chain, in play order.
Show code and tests
Code:
read_mrd_description(),description_from_waveforms(). Tests: a written stream reads back into the rows it was built from; every file of a chain is read in play order; a stream whose data arrives first is refused; the physiological waveforms ahead of the description are passed over; a kept series reads its description from its waveforms; a pulse is integrated on the raster its description states (test_mrd_reader.py).Reproduces the spoiled gradient-echo steady state from a description read either way.
Show code and tests
Code:
from_description(). Tests: the steady state is the spoiled gradient echo closed form (test_pulseq_reader.py); a described sequence drives the spoiled gradient echo steady state (test_mrd_reader.py).
Division of responsibility#
Gradient moments. A description holds one crusher moment for the whole sequence,
crusher_dephasing_radacrossvoxel_size_m, given by the caller; neither file nor stream supplies it.A slice-select gradient that varies under the pulse, as in VERSE or ramp sampling: a file’s pulse is selected by the gradient at its centre.
Pulses with a time shape of their own, sampled unevenly in a Pulseq file, which are refused.
A gradient that belongs to no pulse or readout, such as a preparation’s own spoiler, which no handler reinstates.
Method#
Above, the first thirteen blocks of a spin-echo train and the events they are read as; blocks holding only gradients become WAITs. Below, the readout coordinate \(k_x\) at every ADC sample: each ADC event is stamped at its zero crossing.#
Event classification#
A block holding a pulse becomes an RF event, one holding only an ADC an ADC
event, and any other a WAIT; a block holding both is read as the pulse. An RF
event carries the Pulseq use tag, which selects the handler: refocusing,
inversion and saturation pulses reach their own, and any other pulse the
excitation handler. An ADC event carries a role among the repetition’s samples
and the echo flag; record="acquired" keeps every sample whose role is not
NON_ACQUIRED.
RF shapes#
Events name a definition rather than carry a waveform. Rows of the Pulseq RF
library that differ only in amplitude, phase or frequency, as RF spoiling
writes them, share one definition. The flip angle is \(2\pi\) times the
magnitude of the event amplitude times the envelope’s integral, taken on the
RadiofrequencyRasterTime the description carries. Which rotation the
kernels perform with the definition is on Extended phase graphs.
Timing#
Timestamps count from the start of the repetition read, not of the scan, so a description does not depend on where in the file it was taken. The repetition lasts the sum of its block durations.
Examples#
4. Description-based simulation: a description inspected, then simulated from a Pulseq file and through two sets of handlers.
2. Advanced physics: a shaped pulse from an RF definition, integrated across the slice.