Skip to content

Sequence Model

cmrseq.Sequence is the mutable container for MRI sequence building blocks. A sequence stores RF pulses, gradients, ADC events, delays, and orientation metadata against one SystemSpec.

Composition

Sequences can be built from a list of blocks, extended with new blocks, or combined with other sequences.

new_sequence_object = sequence1 + sequence2
sequence1 += sequence2

The non-mutating addition returns a new sequence containing copied blocks. In-place addition keeps the existing block objects.

Block Access

Blocks are registered with unique names. Access patterns include:

  • seq["trapezoidal_0"] for exact unique block names
  • seq[0], seq[0:5], and seq[(0, 2, 5)] for temporal ordering
  • seq.get_block(...) for name, partial-name, regular-expression, or type queries
  • seq.partial_sequence(...) for extracting matching blocks as a new sequence

Gridding And K-Space

Dense representations can be produced with gradients_to_grid, rf_to_grid, and adc_to_grid. Gradient moments and k-space trajectories are available through calculate_moment and calculate_kspace.

Labels And Triggers

RF and ADC blocks carry a Label object for acquisition counters and Pulseq extensions. Standard labels such as kspace_encode_step_1, slice, contrast, and repetition are exported as Pulseq label set/increment extensions.

triggerWait and triggerSend are special labels used for Pulseq trigger extensions:

adc.label.setLabels("triggerWait", 1000)
rf.label.setLabels("triggerSend", 500)

Values are written as trigger delays in microseconds. During Pulseq export, trigger extensions are placed in their own delay blocks so the trigger duration is explicit in the block table.