Note
Go to the end to download the full example code.
2D echo-planar imaging#
A slice-selective excitation is followed by alternating readout gradients and phase-encode blips that acquire multiple Cartesian lines in one echo train. Spoilers suppress residual transverse coherence between repetitions. Off-resonance phase accumulates during the train and produces geometric distortion along the phase-encode axis. EPI supports rapid structural imaging and functional MRI.
Single-shot acquisition#
Every phase-encode line is acquired after one excitation. Echo-train length equals the number of acquired lines and determines the accumulated off-resonance phase across k-space.
from pypulseqpp.sequences import epi2D_sequence
diagram = epi2D_sequence(
n_x=64,
n_y=48,
n_slices=1,
n_shots=1,
n_dummy=0,
fat_saturation=True,
tr=None,
)
single = epi2D_sequence(n_x=96, n_y=96, n_slices=1, n_shots=1, n_dummy=0)
print(
f"{diagram.num_blocks} blocks, {diagram.duration()[0] * 1e3:.1f} ms, "
f"TE {diagram.get_definition('TE')[0] * 1e3:.2f} ms"
)
58 blocks, 50.6 ms, TE 22.14 ms
Sequence diagram#

Segmentation and in-plane acceleration#
Segmentation and in-plane acceleration both reduce echo-train length.
n_shots interleaves the lines over several excitations, so every line is
still acquired. ry skips lines within one excitation and requires a
parallel-imaging reconstruction for the omitted lines. Off-resonance
\(\Delta f\) adds a phase of \(2\pi \Delta f\, \mathrm{esp}\)
per echo spacing \(\mathrm{esp}\). This phase is linear in \(k_y\)
and displaces the image along the phase-encode axis by
\(\Delta f \cdot \mathrm{esp} \cdot N_\mathrm{etl}\) pixels, where
\(N_\mathrm{etl}\) is the echo-train length. Both segmentation and
acceleration reduce \(N_\mathrm{etl}\) and therefore the displacement.
segmented = epi2D_sequence(n_x=96, n_y=96, n_slices=1, n_shots=3, n_dummy=0)
accelerated = epi2D_sequence(n_x=96, n_y=96, n_slices=1, ry=3, n_dummy=0, n_acs_y=0)
designs = {"1 shot": single, "3 shots": segmented, "ry = 3": accelerated}
echoes trains per train TE (ms) scan (ms) px per Hz
1 shot 96 1 96.0 55.94 108.3 0.100
3 shots 96 3 32.0 23.46 131.6 0.035
ry = 3 32 1 32.0 23.44 43.1 0.035
Echo traversal#
The ordinate gives the phase-encode line acquired at each echo index. A
single shot traverses the axis one line at a time. A segmented acquisition
traverses it in steps of n_shots, each shot starting one line further
on. An accelerated acquisition traverses it once in steps of ry.

Which lines are acquired#
Segmentation and acceleration produce the same train length from different sets of lines: the segmented acquisition acquires every line, the accelerated acquisition one line in three.

Functional MRI time series#
Repeated frames form an fMRI time series. The acquisition below uses eight
slices in four multiband groups. REP identifies the volume and SLC
identifies the group; acquisition times are the start times of the ADC
blocks in the sequence.
fmri = epi2D_sequence(
n_x=64,
n_y=64,
n_slices=8,
multiband=2,
n_frames=4,
n_shots=1,
n_dummy=0,
fat_saturation=False,
tr=1.0,
)
labels = fmri.evaluate_labels(evolution="adc")

Total running time of the script: (0 minutes 0.832 seconds)